diff options
Diffstat (limited to 'drivers/char/rio')
72 files changed, 7381 insertions, 8030 deletions
diff --git a/drivers/char/rio/board.h b/drivers/char/rio/board.h index 0b397e1c8f1c..29c980204098 100644 --- a/drivers/char/rio/board.h +++ b/drivers/char/rio/board.h | |||
@@ -52,63 +52,57 @@ static char *_board_h_sccs_ = "@(#)board.h 1.2"; | |||
52 | /* | 52 | /* |
53 | ** The shape of the Host Control area, at offset 0x7C00, Write Only | 53 | ** The shape of the Host Control area, at offset 0x7C00, Write Only |
54 | */ | 54 | */ |
55 | struct s_Ctrl | 55 | struct s_Ctrl { |
56 | { | 56 | BYTE DpCtl; /* 7C00 */ |
57 | BYTE DpCtl; /* 7C00 */ | 57 | BYTE Dp_Unused2_[127]; |
58 | BYTE Dp_Unused2_[127]; | 58 | BYTE DpIntSet; /* 7C80 */ |
59 | BYTE DpIntSet; /* 7C80 */ | 59 | BYTE Dp_Unused3_[127]; |
60 | BYTE Dp_Unused3_[127]; | 60 | BYTE DpTpuReset; /* 7D00 */ |
61 | BYTE DpTpuReset; /* 7D00 */ | 61 | BYTE Dp_Unused4_[127]; |
62 | BYTE Dp_Unused4_[127]; | 62 | BYTE DpIntReset; /* 7D80 */ |
63 | BYTE DpIntReset; /* 7D80 */ | 63 | BYTE Dp_Unused5_[127]; |
64 | BYTE Dp_Unused5_[127]; | ||
65 | }; | 64 | }; |
66 | 65 | ||
67 | /* | 66 | /* |
68 | ** The PROM data area on the host (0x7C00), Read Only | 67 | ** The PROM data area on the host (0x7C00), Read Only |
69 | */ | 68 | */ |
70 | struct s_Prom | 69 | struct s_Prom { |
71 | { | 70 | WORD DpSlxCode[2]; |
72 | WORD DpSlxCode[2]; | 71 | WORD DpRev; |
73 | WORD DpRev; | 72 | WORD Dp_Unused6_; |
74 | WORD Dp_Unused6_; | 73 | WORD DpUniq[4]; |
75 | WORD DpUniq[4]; | 74 | WORD DpJahre; |
76 | WORD DpJahre; | 75 | WORD DpWoche; |
77 | WORD DpWoche; | 76 | WORD DpHwFeature[5]; |
78 | WORD DpHwFeature[5]; | 77 | WORD DpOemId; |
79 | WORD DpOemId; | 78 | WORD DpSiggy[16]; |
80 | WORD DpSiggy[16]; | ||
81 | }; | 79 | }; |
82 | 80 | ||
83 | /* | 81 | /* |
84 | ** Union of the Ctrl and Prom areas | 82 | ** Union of the Ctrl and Prom areas |
85 | */ | 83 | */ |
86 | union u_CtrlProm /* This is the control/PROM area (0x7C00) */ | 84 | union u_CtrlProm { /* This is the control/PROM area (0x7C00) */ |
87 | { | 85 | struct s_Ctrl DpCtrl; |
88 | struct s_Ctrl DpCtrl; | 86 | struct s_Prom DpProm; |
89 | struct s_Prom DpProm; | ||
90 | }; | 87 | }; |
91 | 88 | ||
92 | /* | 89 | /* |
93 | ** The top end of memory! | 90 | ** The top end of memory! |
94 | */ | 91 | */ |
95 | struct s_ParmMapS /* Area containing Parm Map Pointer */ | 92 | struct s_ParmMapS { /* Area containing Parm Map Pointer */ |
96 | { | 93 | BYTE Dp_Unused8_[DP_PARMMAP_ADDR]; |
97 | BYTE Dp_Unused8_[DP_PARMMAP_ADDR]; | 94 | WORD DpParmMapAd; |
98 | WORD DpParmMapAd; | ||
99 | }; | 95 | }; |
100 | 96 | ||
101 | struct s_StartUpS | 97 | struct s_StartUpS { |
102 | { | 98 | BYTE Dp_Unused9_[DP_STARTUP_ADDR]; |
103 | BYTE Dp_Unused9_[DP_STARTUP_ADDR]; | 99 | BYTE Dp_LongJump[0x4]; |
104 | BYTE Dp_LongJump[0x4]; | 100 | BYTE Dp_Unused10_[2]; |
105 | BYTE Dp_Unused10_[2]; | 101 | BYTE Dp_ShortJump[0x2]; |
106 | BYTE Dp_ShortJump[0x2]; | ||
107 | }; | 102 | }; |
108 | 103 | ||
109 | union u_Sram2ParmMap /* This is the top of memory (0x7E00-0x7FFF) */ | 104 | union u_Sram2ParmMap { /* This is the top of memory (0x7E00-0x7FFF) */ |
110 | { | 105 | BYTE DpSramMem[DP_SRAM2_SIZE]; |
111 | BYTE DpSramMem[DP_SRAM2_SIZE]; | ||
112 | struct s_ParmMapS DpParmMapS; | 106 | struct s_ParmMapS DpParmMapS; |
113 | struct s_StartUpS DpStartUpS; | 107 | struct s_StartUpS DpStartUpS; |
114 | }; | 108 | }; |
@@ -116,13 +110,12 @@ union u_Sram2ParmMap /* This is the top of memory (0x7E00-0x7FFF) */ | |||
116 | /* | 110 | /* |
117 | ** This is the DP RAM overlay. | 111 | ** This is the DP RAM overlay. |
118 | */ | 112 | */ |
119 | struct DpRam | 113 | struct DpRam { |
120 | { | 114 | BYTE DpSram1[DP_SRAM1_SIZE]; /* 0000 - 7BFF */ |
121 | BYTE DpSram1[DP_SRAM1_SIZE]; /* 0000 - 7BFF */ | 115 | union u_CtrlProm DpCtrlProm; /* 7C00 - 7DFF */ |
122 | union u_CtrlProm DpCtrlProm; /* 7C00 - 7DFF */ | 116 | union u_Sram2ParmMap DpSram2ParmMap; /* 7E00 - 7FFF */ |
123 | union u_Sram2ParmMap DpSram2ParmMap; /* 7E00 - 7FFF */ | 117 | BYTE DpScratch[DP_SCRATCH_SIZE]; /* 8000 - 8FFF */ |
124 | BYTE DpScratch[DP_SCRATCH_SIZE]; /* 8000 - 8FFF */ | 118 | BYTE DpSram3[DP_SRAM3_SIZE]; /* 9000 - FFFF */ |
125 | BYTE DpSram3[DP_SRAM3_SIZE]; /* 9000 - FFFF */ | ||
126 | }; | 119 | }; |
127 | 120 | ||
128 | #define DpControl DpCtrlProm.DpCtrl.DpCtl | 121 | #define DpControl DpCtrlProm.DpCtrl.DpCtl |
diff --git a/drivers/char/rio/bootpkt.h b/drivers/char/rio/bootpkt.h index c329aeb7c871..602266e0c085 100644 --- a/drivers/char/rio/bootpkt.h +++ b/drivers/char/rio/bootpkt.h | |||
@@ -41,7 +41,7 @@ | |||
41 | 41 | ||
42 | #ifndef lint | 42 | #ifndef lint |
43 | #ifdef SCCS | 43 | #ifdef SCCS |
44 | static char *_rio_bootpkt_h_sccs = "@(#)bootpkt.h 1.1" ; | 44 | static char *_rio_bootpkt_h_sccs = "@(#)bootpkt.h 1.1"; |
45 | #endif | 45 | #endif |
46 | #endif | 46 | #endif |
47 | 47 | ||
@@ -49,14 +49,13 @@ static char *_rio_bootpkt_h_sccs = "@(#)bootpkt.h 1.1" ; | |||
49 | * Overlayed onto the Data fields of a regular | 49 | * Overlayed onto the Data fields of a regular |
50 | * Packet | 50 | * Packet |
51 | ************************************************/ | 51 | ************************************************/ |
52 | typedef struct BOOT_PKT BOOT_PKT ; | 52 | typedef struct BOOT_PKT BOOT_PKT; |
53 | struct BOOT_PKT { | 53 | struct BOOT_PKT { |
54 | short seq_num ; | 54 | short seq_num; |
55 | char data[10] ; | 55 | char data[10]; |
56 | } ; | 56 | }; |
57 | 57 | ||
58 | 58 | ||
59 | #endif | 59 | #endif |
60 | 60 | ||
61 | /*********** end of file ***********/ | 61 | /*********** end of file ***********/ |
62 | |||
diff --git a/drivers/char/rio/brates.h b/drivers/char/rio/brates.h index bd4fc84ec6cf..dd686d58fd66 100644 --- a/drivers/char/rio/brates.h +++ b/drivers/char/rio/brates.h | |||
@@ -97,11 +97,10 @@ | |||
97 | 97 | ||
98 | #define MAX_RATE B2000 | 98 | #define MAX_RATE B2000 |
99 | 99 | ||
100 | struct baud_rate /* Tag for baud rates */ | 100 | struct baud_rate { /* Tag for baud rates */ |
101 | { | 101 | /* short host_rate, *//* As passed by the driver */ |
102 | /* short host_rate,*/ /* As passed by the driver */ | 102 | short divisor, /* The divisor */ |
103 | short divisor, /* The divisor */ | 103 | prescaler; /* The pre-scaler */ |
104 | prescaler; /* The pre-scaler */ | ||
105 | }; | 104 | }; |
106 | 105 | ||
107 | #endif | 106 | #endif |
diff --git a/drivers/char/rio/chan.h b/drivers/char/rio/chan.h index 5b306543328f..af14311f9b66 100644 --- a/drivers/char/rio/chan.h +++ b/drivers/char/rio/chan.h | |||
@@ -21,7 +21,7 @@ | |||
21 | 21 | ||
22 | #ifndef lint | 22 | #ifndef lint |
23 | #ifdef SCCS | 23 | #ifdef SCCS |
24 | static char *_rio_chan_h_sccs = "@(#)chan.h 1.1" ; | 24 | static char *_rio_chan_h_sccs = "@(#)chan.h 1.1"; |
25 | #endif | 25 | #endif |
26 | #endif | 26 | #endif |
27 | 27 | ||
diff --git a/drivers/char/rio/cirrus.h b/drivers/char/rio/cirrus.h index cf056a990f18..217ff09f2fa1 100644 --- a/drivers/char/rio/cirrus.h +++ b/drivers/char/rio/cirrus.h | |||
@@ -73,20 +73,20 @@ | |||
73 | #define TIMER_TICK 0x82 | 73 | #define TIMER_TICK 0x82 |
74 | #define STOP_BREAK 0x83 | 74 | #define STOP_BREAK 0x83 |
75 | #define BASE(a) ((a) < 4 ? (short*)CIRRUS_FIRST : ((a) < 8 ? (short *)CIRRUS_SECOND : ((a) < 12 ? (short*)CIRRUS_THIRD : (short *)CIRRUS_FOURTH))) | 75 | #define BASE(a) ((a) < 4 ? (short*)CIRRUS_FIRST : ((a) < 8 ? (short *)CIRRUS_SECOND : ((a) < 12 ? (short*)CIRRUS_THIRD : (short *)CIRRUS_FOURTH))) |
76 | #define txack1 ((short *)0x7104) | 76 | #define txack1 ((short *)0x7104) |
77 | #define rxack1 ((short *)0x7102) | 77 | #define rxack1 ((short *)0x7102) |
78 | #define mdack1 ((short *)0x7106) | 78 | #define mdack1 ((short *)0x7106) |
79 | #define txack2 ((short *)0x7006) | 79 | #define txack2 ((short *)0x7006) |
80 | #define rxack2 ((short *)0x7004) | 80 | #define rxack2 ((short *)0x7004) |
81 | #define mdack2 ((short *)0x7100) | 81 | #define mdack2 ((short *)0x7100) |
82 | #define int_latch ((short *) 0x7800) | 82 | #define int_latch ((short *) 0x7800) |
83 | #define int_status ((short *) 0x7c00) | 83 | #define int_status ((short *) 0x7c00) |
84 | #define tx1_pending 0x20 | 84 | #define tx1_pending 0x20 |
85 | #define rx1_pending 0x10 | 85 | #define rx1_pending 0x10 |
86 | #define md1_pending 0x40 | 86 | #define md1_pending 0x40 |
87 | #define tx2_pending 0x02 | 87 | #define tx2_pending 0x02 |
88 | #define rx2_pending 0x01 | 88 | #define rx2_pending 0x01 |
89 | #define md2_pending 0x40 | 89 | #define md2_pending 0x40 |
90 | #define module1_bits 0x07 | 90 | #define module1_bits 0x07 |
91 | #define module1_modern 0x08 | 91 | #define module1_modern 0x08 |
92 | #define module2_bits 0x70 | 92 | #define module2_bits 0x70 |
@@ -113,65 +113,65 @@ | |||
113 | NB. These registers are relative values on 8 bit boundaries whereas | 113 | NB. These registers are relative values on 8 bit boundaries whereas |
114 | on the RTA's the CIRRUS registers are on word boundaries. Use pointer | 114 | on the RTA's the CIRRUS registers are on word boundaries. Use pointer |
115 | arithmetic (short *) to obtain the real addresses required */ | 115 | arithmetic (short *) to obtain the real addresses required */ |
116 | #define ccr 0x05 /* Channel Command Register */ | 116 | #define ccr 0x05 /* Channel Command Register */ |
117 | #define ier 0x06 /* Interrupt Enable Register */ | 117 | #define ier 0x06 /* Interrupt Enable Register */ |
118 | #define cor1 0x08 /* Channel Option Register 1 */ | 118 | #define cor1 0x08 /* Channel Option Register 1 */ |
119 | #define cor2 0x09 /* Channel Option Register 2 */ | 119 | #define cor2 0x09 /* Channel Option Register 2 */ |
120 | #define cor3 0x0a /* Channel Option Register 3 */ | 120 | #define cor3 0x0a /* Channel Option Register 3 */ |
121 | #define cor4 0x1e /* Channel Option Register 4 */ | 121 | #define cor4 0x1e /* Channel Option Register 4 */ |
122 | #define cor5 0x1f /* Channel Option Register 5 */ | 122 | #define cor5 0x1f /* Channel Option Register 5 */ |
123 | 123 | ||
124 | #define ccsr 0x0b /* Channel Control Status Register */ | 124 | #define ccsr 0x0b /* Channel Control Status Register */ |
125 | #define rdcr 0x0e /* Receive Data Count Register */ | 125 | #define rdcr 0x0e /* Receive Data Count Register */ |
126 | #define tdcr 0x12 /* Transmit Data Count Register */ | 126 | #define tdcr 0x12 /* Transmit Data Count Register */ |
127 | #define mcor1 0x15 /* Modem Change Option Register 1 */ | 127 | #define mcor1 0x15 /* Modem Change Option Register 1 */ |
128 | #define mcor2 0x16 /* Modem Change Option Regsiter 2 */ | 128 | #define mcor2 0x16 /* Modem Change Option Regsiter 2 */ |
129 | 129 | ||
130 | #define livr 0x18 /* Local Interrupt Vector Register */ | 130 | #define livr 0x18 /* Local Interrupt Vector Register */ |
131 | #define schr1 0x1a /* Special Character Register 1 */ | 131 | #define schr1 0x1a /* Special Character Register 1 */ |
132 | #define schr2 0x1b /* Special Character Register 2 */ | 132 | #define schr2 0x1b /* Special Character Register 2 */ |
133 | #define schr3 0x1c /* Special Character Register 3 */ | 133 | #define schr3 0x1c /* Special Character Register 3 */ |
134 | #define schr4 0x1d /* Special Character Register 4 */ | 134 | #define schr4 0x1d /* Special Character Register 4 */ |
135 | 135 | ||
136 | #define rtr 0x20 /* Receive Timer Register */ | 136 | #define rtr 0x20 /* Receive Timer Register */ |
137 | #define rtpr 0x21 /* Receive Timeout Period Register */ | 137 | #define rtpr 0x21 /* Receive Timeout Period Register */ |
138 | #define lnc 0x24 /* Lnext character */ | 138 | #define lnc 0x24 /* Lnext character */ |
139 | 139 | ||
140 | #define rivr 0x43 /* Receive Interrupt Vector Register */ | 140 | #define rivr 0x43 /* Receive Interrupt Vector Register */ |
141 | #define tivr 0x42 /* Transmit Interrupt Vector Register */ | 141 | #define tivr 0x42 /* Transmit Interrupt Vector Register */ |
142 | #define mivr 0x41 /* Modem Interrupt Vector Register */ | 142 | #define mivr 0x41 /* Modem Interrupt Vector Register */ |
143 | #define gfrcr 0x40 /* Global Firmware Revision code Reg */ | 143 | #define gfrcr 0x40 /* Global Firmware Revision code Reg */ |
144 | #define ricr 0x44 /* Receive Interrupting Channel Reg */ | 144 | #define ricr 0x44 /* Receive Interrupting Channel Reg */ |
145 | #define ticr 0x45 /* Transmit Interrupting Channel Reg */ | 145 | #define ticr 0x45 /* Transmit Interrupting Channel Reg */ |
146 | #define micr 0x46 /* Modem Interrupting Channel Register */ | 146 | #define micr 0x46 /* Modem Interrupting Channel Register */ |
147 | 147 | ||
148 | #define gcr 0x4b /* Global configuration register*/ | 148 | #define gcr 0x4b /* Global configuration register */ |
149 | #define misr 0x4c /* Modem interrupt status register */ | 149 | #define misr 0x4c /* Modem interrupt status register */ |
150 | 150 | ||
151 | #define rbusr 0x59 | 151 | #define rbusr 0x59 |
152 | #define tbusr 0x5a | 152 | #define tbusr 0x5a |
153 | #define mbusr 0x5b | 153 | #define mbusr 0x5b |
154 | 154 | ||
155 | #define eoir 0x60 /* End Of Interrupt Register */ | 155 | #define eoir 0x60 /* End Of Interrupt Register */ |
156 | #define rdsr 0x62 /* Receive Data / Status Register */ | 156 | #define rdsr 0x62 /* Receive Data / Status Register */ |
157 | #define tdr 0x63 /* Transmit Data Register */ | 157 | #define tdr 0x63 /* Transmit Data Register */ |
158 | #define svrr 0x67 /* Service Request Register */ | 158 | #define svrr 0x67 /* Service Request Register */ |
159 | 159 | ||
160 | #define car 0x68 /* Channel Access Register */ | 160 | #define car 0x68 /* Channel Access Register */ |
161 | #define mir 0x69 /* Modem Interrupt Register */ | 161 | #define mir 0x69 /* Modem Interrupt Register */ |
162 | #define tir 0x6a /* Transmit Interrupt Register */ | 162 | #define tir 0x6a /* Transmit Interrupt Register */ |
163 | #define rir 0x6b /* Receive Interrupt Register */ | 163 | #define rir 0x6b /* Receive Interrupt Register */ |
164 | #define msvr1 0x6c /* Modem Signal Value Register 1 */ | 164 | #define msvr1 0x6c /* Modem Signal Value Register 1 */ |
165 | #define msvr2 0x6d /* Modem Signal Value Register 2*/ | 165 | #define msvr2 0x6d /* Modem Signal Value Register 2 */ |
166 | #define psvr 0x6f /* Printer Signal Value Register*/ | 166 | #define psvr 0x6f /* Printer Signal Value Register */ |
167 | 167 | ||
168 | #define tbpr 0x72 /* Transmit Baud Rate Period Register */ | 168 | #define tbpr 0x72 /* Transmit Baud Rate Period Register */ |
169 | #define tcor 0x76 /* Transmit Clock Option Register */ | 169 | #define tcor 0x76 /* Transmit Clock Option Register */ |
170 | 170 | ||
171 | #define rbpr 0x78 /* Receive Baud Rate Period Register */ | 171 | #define rbpr 0x78 /* Receive Baud Rate Period Register */ |
172 | #define rber 0x7a /* Receive Baud Rate Extension Register */ | 172 | #define rber 0x7a /* Receive Baud Rate Extension Register */ |
173 | #define rcor 0x7c /* Receive Clock Option Register*/ | 173 | #define rcor 0x7c /* Receive Clock Option Register */ |
174 | #define ppr 0x7e /* Prescalar Period Register */ | 174 | #define ppr 0x7e /* Prescalar Period Register */ |
175 | 175 | ||
176 | /* Misc registers used for forcing the 1400 out of its reset woes */ | 176 | /* Misc registers used for forcing the 1400 out of its reset woes */ |
177 | #define airl 0x6d | 177 | #define airl 0x6d |
@@ -192,10 +192,10 @@ | |||
192 | 192 | ||
193 | /* RDSR - when status read from FIFO */ | 193 | /* RDSR - when status read from FIFO */ |
194 | #define RDSR_BREAK 0x08 /* Break received */ | 194 | #define RDSR_BREAK 0x08 /* Break received */ |
195 | #define RDSR_TIMEOUT 0x80 /* No new data timeout */ | 195 | #define RDSR_TIMEOUT 0x80 /* No new data timeout */ |
196 | #define RDSR_SC1 0x10 /* Special char 1 (tx XON) matched */ | 196 | #define RDSR_SC1 0x10 /* Special char 1 (tx XON) matched */ |
197 | #define RDSR_SC2 0x20 /* Special char 2 (tx XOFF) matched */ | 197 | #define RDSR_SC2 0x20 /* Special char 2 (tx XOFF) matched */ |
198 | #define RDSR_SC12_MASK 0x30 /* Mask for special chars 1 and 2 */ | 198 | #define RDSR_SC12_MASK 0x30 /* Mask for special chars 1 and 2 */ |
199 | 199 | ||
200 | /* PPR */ | 200 | /* PPR */ |
201 | #define PPR_DEFAULT 0x31 /* Default value - for a 25Mhz clock gives | 201 | #define PPR_DEFAULT 0x31 /* Default value - for a 25Mhz clock gives |
@@ -244,7 +244,7 @@ | |||
244 | #define IER_TIMEOUT 0x01 /* Timeout on no data */ | 244 | #define IER_TIMEOUT 0x01 /* Timeout on no data */ |
245 | 245 | ||
246 | #define IER_DEFAULT 0x94 /* Default values */ | 246 | #define IER_DEFAULT 0x94 /* Default values */ |
247 | #define IER_PARALLEL 0x84 /* Default for Parallel */ | 247 | #define IER_PARALLEL 0x84 /* Default for Parallel */ |
248 | #define IER_EMPTY 0x92 /* Transmitter empty rather than ready */ | 248 | #define IER_EMPTY 0x92 /* Transmitter empty rather than ready */ |
249 | 249 | ||
250 | /* COR1 - Driver only */ | 250 | /* COR1 - Driver only */ |
@@ -264,11 +264,11 @@ | |||
264 | #define COR1_7BITS 0x02 /* 7 data bits */ | 264 | #define COR1_7BITS 0x02 /* 7 data bits */ |
265 | #define COR1_8BITS 0x03 /* 8 data bits */ | 265 | #define COR1_8BITS 0x03 /* 8 data bits */ |
266 | 266 | ||
267 | #define COR1_HOST 0xef /* Safe host bits */ | 267 | #define COR1_HOST 0xef /* Safe host bits */ |
268 | 268 | ||
269 | /* RTA only */ | 269 | /* RTA only */ |
270 | #define COR1_CINPCK 0x00 /* Check parity of received characters */ | 270 | #define COR1_CINPCK 0x00 /* Check parity of received characters */ |
271 | #define COR1_CNINPCK 0x10 /* Don't check parity */ | 271 | #define COR1_CNINPCK 0x10 /* Don't check parity */ |
272 | 272 | ||
273 | /* COR2 bits for both RTA and driver use */ | 273 | /* COR2 bits for both RTA and driver use */ |
274 | #define COR2_IXANY 0x80 /* IXANY - any character is XON */ | 274 | #define COR2_IXANY 0x80 /* IXANY - any character is XON */ |
@@ -293,9 +293,9 @@ | |||
293 | #define COR3_FCT 0x20 /* Flow control transparency */ | 293 | #define COR3_FCT 0x20 /* Flow control transparency */ |
294 | #define COR3_SCD12 0x10 /* Special character detect for SCHR's 1 + 2 */ | 294 | #define COR3_SCD12 0x10 /* Special character detect for SCHR's 1 + 2 */ |
295 | #define COR3_FIFO12 0x0c /* 12 chars for receive FIFO threshold */ | 295 | #define COR3_FIFO12 0x0c /* 12 chars for receive FIFO threshold */ |
296 | #define COR3_FIFO10 0x0a /* 10 chars for receive FIFO threshold */ | 296 | #define COR3_FIFO10 0x0a /* 10 chars for receive FIFO threshold */ |
297 | #define COR3_FIFO8 0x08 /* 8 chars for receive FIFO threshold */ | 297 | #define COR3_FIFO8 0x08 /* 8 chars for receive FIFO threshold */ |
298 | #define COR3_FIFO6 0x06 /* 6 chars for receive FIFO threshold */ | 298 | #define COR3_FIFO6 0x06 /* 6 chars for receive FIFO threshold */ |
299 | 299 | ||
300 | #define COR3_THRESHOLD COR3_FIFO8 /* MUST BE LESS THAN MCOR_THRESHOLD */ | 300 | #define COR3_THRESHOLD COR3_FIFO8 /* MUST BE LESS THAN MCOR_THRESHOLD */ |
301 | 301 | ||
@@ -386,7 +386,7 @@ | |||
386 | 386 | ||
387 | #define MCOR_THRESHBITS 0x0F /* mask for ANDing out the above */ | 387 | #define MCOR_THRESHBITS 0x0F /* mask for ANDing out the above */ |
388 | 388 | ||
389 | #define MCOR_THRESHOLD MCOR_THRESH9 /* MUST BE GREATER THAN COR3_THRESHOLD */ | 389 | #define MCOR_THRESHOLD MCOR_THRESH9 /* MUST BE GREATER THAN COR3_THRESHOLD */ |
390 | 390 | ||
391 | 391 | ||
392 | /* RTPR */ | 392 | /* RTPR */ |
@@ -429,25 +429,25 @@ | |||
429 | #define CONFIG 0x01 /* Configure a port */ | 429 | #define CONFIG 0x01 /* Configure a port */ |
430 | #define MOPEN 0x02 /* Modem open (block for DCD) */ | 430 | #define MOPEN 0x02 /* Modem open (block for DCD) */ |
431 | #define CLOSE 0x03 /* Close a port */ | 431 | #define CLOSE 0x03 /* Close a port */ |
432 | #define WFLUSH (0x04 | PRE_EMPTIVE) /* Write flush */ | 432 | #define WFLUSH (0x04 | PRE_EMPTIVE) /* Write flush */ |
433 | #define RFLUSH (0x05 | PRE_EMPTIVE) /* Read flush */ | 433 | #define RFLUSH (0x05 | PRE_EMPTIVE) /* Read flush */ |
434 | #define RESUME (0x06 | PRE_EMPTIVE) /* Resume if xoffed */ | 434 | #define RESUME (0x06 | PRE_EMPTIVE) /* Resume if xoffed */ |
435 | #define SBREAK 0x07 /* Start break */ | 435 | #define SBREAK 0x07 /* Start break */ |
436 | #define EBREAK 0x08 /* End break */ | 436 | #define EBREAK 0x08 /* End break */ |
437 | #define SUSPEND (0x09 | PRE_EMPTIVE) /* Susp op (behave as tho xoffed) */ | 437 | #define SUSPEND (0x09 | PRE_EMPTIVE) /* Susp op (behave as tho xoffed) */ |
438 | #define FCLOSE (0x0a | PRE_EMPTIVE) /* Force close */ | 438 | #define FCLOSE (0x0a | PRE_EMPTIVE) /* Force close */ |
439 | #define XPRINT 0x0b /* Xprint packet */ | 439 | #define XPRINT 0x0b /* Xprint packet */ |
440 | #define MBIS (0x0c | PRE_EMPTIVE) /* Set modem lines */ | 440 | #define MBIS (0x0c | PRE_EMPTIVE) /* Set modem lines */ |
441 | #define MBIC (0x0d | PRE_EMPTIVE) /* Clear modem lines */ | 441 | #define MBIC (0x0d | PRE_EMPTIVE) /* Clear modem lines */ |
442 | #define MSET (0x0e | PRE_EMPTIVE) /* Set modem lines */ | 442 | #define MSET (0x0e | PRE_EMPTIVE) /* Set modem lines */ |
443 | #define PCLOSE 0x0f /* Pseudo close - Leaves rx/tx enabled */ | 443 | #define PCLOSE 0x0f /* Pseudo close - Leaves rx/tx enabled */ |
444 | #define MGET (0x10 | PRE_EMPTIVE) /* Force update of modem status */ | 444 | #define MGET (0x10 | PRE_EMPTIVE) /* Force update of modem status */ |
445 | #define MEMDUMP (0x11 | PRE_EMPTIVE) /* Send back mem from addr supplied */ | 445 | #define MEMDUMP (0x11 | PRE_EMPTIVE) /* Send back mem from addr supplied */ |
446 | #define READ_REGISTER (0x12 | PRE_EMPTIVE) /* Read CD1400 register (debug) */ | 446 | #define READ_REGISTER (0x12 | PRE_EMPTIVE) /* Read CD1400 register (debug) */ |
447 | 447 | ||
448 | /* "Command" packets going from remote to host COMPLETE and MODEM_STATUS | 448 | /* "Command" packets going from remote to host COMPLETE and MODEM_STATUS |
449 | use data[4] / data[3] to indicate current state and modem status respectively | 449 | use data[4] / data[3] to indicate current state and modem status respectively |
450 | */ | 450 | */ |
451 | 451 | ||
452 | #define COMPLETE (0x20 | PRE_EMPTIVE) | 452 | #define COMPLETE (0x20 | PRE_EMPTIVE) |
453 | /* Command complete */ | 453 | /* Command complete */ |
diff --git a/drivers/char/rio/cmd.h b/drivers/char/rio/cmd.h index c369edaea2b3..797b62400c91 100644 --- a/drivers/char/rio/cmd.h +++ b/drivers/char/rio/cmd.h | |||
@@ -42,7 +42,7 @@ | |||
42 | 42 | ||
43 | #ifndef lint | 43 | #ifndef lint |
44 | #ifdef SCCS | 44 | #ifdef SCCS |
45 | static char *_rio_cmd_h_sccs = "@(#)cmd.h 1.1" ; | 45 | static char *_rio_cmd_h_sccs = "@(#)cmd.h 1.1"; |
46 | #endif | 46 | #endif |
47 | #endif | 47 | #endif |
48 | 48 | ||
@@ -52,7 +52,7 @@ static char *_rio_cmd_h_sccs = "@(#)cmd.h 1.1" ; | |||
52 | 52 | ||
53 | #define CMD_IGNORE_PKT ( (ushort) 0) | 53 | #define CMD_IGNORE_PKT ( (ushort) 0) |
54 | #define CMD_STATUS_REQ ( (ushort) 1) | 54 | #define CMD_STATUS_REQ ( (ushort) 1) |
55 | #define CMD_UNIT_STATUS_REQ ( (ushort) 2) /* Is this needed ??? */ | 55 | #define CMD_UNIT_STATUS_REQ ( (ushort) 2) /* Is this needed ??? */ |
56 | #define CMD_CONF_PORT ( (ushort) 3) | 56 | #define CMD_CONF_PORT ( (ushort) 3) |
57 | #define CMD_CONF_UNIT ( (ushort) 4) | 57 | #define CMD_CONF_UNIT ( (ushort) 4) |
58 | #define CMD_ROUTE_MAP_REQ ( (ushort) 5) | 58 | #define CMD_ROUTE_MAP_REQ ( (ushort) 5) |
@@ -81,4 +81,3 @@ static char *_rio_cmd_h_sccs = "@(#)cmd.h 1.1" ; | |||
81 | #endif | 81 | #endif |
82 | 82 | ||
83 | /*********** end of file ***********/ | 83 | /*********** end of file ***********/ |
84 | |||
diff --git a/drivers/char/rio/cmdblk.h b/drivers/char/rio/cmdblk.h index 2b8efbdbee1c..a9a8c45631d7 100644 --- a/drivers/char/rio/cmdblk.h +++ b/drivers/char/rio/cmdblk.h | |||
@@ -44,16 +44,15 @@ static char *_cmdblk_h_sccs_ = "@(#)cmdblk.h 1.2"; | |||
44 | ** a rup. | 44 | ** a rup. |
45 | */ | 45 | */ |
46 | 46 | ||
47 | struct CmdBlk | 47 | struct CmdBlk { |
48 | { | 48 | struct CmdBlk *NextP; /* Pointer to next command block */ |
49 | struct CmdBlk *NextP; /* Pointer to next command block */ | 49 | struct PKT Packet; /* A packet, to copy to the rup */ |
50 | struct PKT Packet; /* A packet, to copy to the rup */ | 50 | /* The func to call to check if OK */ |
51 | /* The func to call to check if OK */ | 51 | int (*PreFuncP) (int, struct CmdBlk *); |
52 | int (*PreFuncP)(int, struct CmdBlk *); | 52 | int PreArg; /* The arg for the func */ |
53 | int PreArg; /* The arg for the func */ | 53 | /* The func to call when completed */ |
54 | /* The func to call when completed */ | 54 | int (*PostFuncP) (int, struct CmdBlk *); |
55 | int (*PostFuncP)(int, struct CmdBlk *); | 55 | int PostArg; /* The arg for the func */ |
56 | int PostArg; /* The arg for the func */ | ||
57 | }; | 56 | }; |
58 | 57 | ||
59 | #define NUM_RIO_CMD_BLKS (3 * (MAX_RUP * 4 + LINKS_PER_UNIT * 4)) | 58 | #define NUM_RIO_CMD_BLKS (3 * (MAX_RUP * 4 + LINKS_PER_UNIT * 4)) |
diff --git a/drivers/char/rio/cmdpkt.h b/drivers/char/rio/cmdpkt.h index 46befd354f20..77cee8df68ef 100644 --- a/drivers/char/rio/cmdpkt.h +++ b/drivers/char/rio/cmdpkt.h | |||
@@ -54,135 +54,112 @@ static char *_cmdpkt_h_sccs_ = "@(#)cmdpkt.h 1.2"; | |||
54 | ** This structure overlays a PktCmd->CmdData structure, and so starts | 54 | ** This structure overlays a PktCmd->CmdData structure, and so starts |
55 | ** at Data[2] in the actual pkt! | 55 | ** at Data[2] in the actual pkt! |
56 | */ | 56 | */ |
57 | struct BootSequence | 57 | struct BootSequence { |
58 | { | 58 | WORD NumPackets; |
59 | WORD NumPackets; | 59 | WORD LoadBase; |
60 | WORD LoadBase; | 60 | WORD CodeSize; |
61 | WORD CodeSize; | ||
62 | }; | 61 | }; |
63 | 62 | ||
64 | #define BOOT_SEQUENCE_LEN 8 | 63 | #define BOOT_SEQUENCE_LEN 8 |
65 | 64 | ||
66 | struct SamTop | 65 | struct SamTop { |
67 | { | 66 | BYTE Unit; |
68 | BYTE Unit; | 67 | BYTE Link; |
69 | BYTE Link; | ||
70 | }; | 68 | }; |
71 | 69 | ||
72 | struct CmdHdr | 70 | struct CmdHdr { |
73 | { | 71 | BYTE PcCommand; |
74 | BYTE PcCommand; | 72 | union { |
75 | union | 73 | BYTE PcPhbNum; |
76 | { | 74 | BYTE PcLinkNum; |
77 | BYTE PcPhbNum; | 75 | BYTE PcIDNum; |
78 | BYTE PcLinkNum; | 76 | } U0; |
79 | BYTE PcIDNum; | ||
80 | } U0; | ||
81 | }; | 77 | }; |
82 | 78 | ||
83 | 79 | ||
84 | struct PktCmd | 80 | struct PktCmd { |
85 | { | 81 | union { |
86 | union | 82 | struct { |
87 | { | 83 | struct CmdHdr CmdHdr; |
88 | struct | 84 | struct BootSequence PcBootSequence; |
89 | { | 85 | } S1; |
90 | struct CmdHdr CmdHdr; | 86 | struct { |
91 | struct BootSequence PcBootSequence; | 87 | WORD PcSequence; |
92 | } S1; | 88 | BYTE PcBootData[RTA_BOOT_DATA_SIZE]; |
93 | struct | 89 | } S2; |
94 | { | 90 | struct { |
95 | WORD PcSequence; | 91 | WORD __crud__; |
96 | BYTE PcBootData[RTA_BOOT_DATA_SIZE]; | 92 | BYTE PcUniqNum[4]; /* this is really a uint. */ |
97 | } S2; | 93 | BYTE PcModuleTypes; /* what modules are fitted */ |
98 | struct | 94 | } S3; |
99 | { | 95 | struct { |
100 | WORD __crud__; | 96 | struct CmdHdr CmdHdr; |
101 | BYTE PcUniqNum[4]; /* this is really a uint. */ | 97 | BYTE __undefined__; |
102 | BYTE PcModuleTypes; /* what modules are fitted */ | 98 | BYTE PcModemStatus; |
103 | } S3; | 99 | BYTE PcPortStatus; |
104 | struct | 100 | BYTE PcSubCommand; /* commands like mem or register dump */ |
105 | { | 101 | WORD PcSubAddr; /* Address for command */ |
106 | struct CmdHdr CmdHdr; | 102 | BYTE PcSubData[64]; /* Date area for command */ |
107 | BYTE __undefined__; | 103 | } S4; |
108 | BYTE PcModemStatus; | 104 | struct { |
109 | BYTE PcPortStatus; | 105 | struct CmdHdr CmdHdr; |
110 | BYTE PcSubCommand; /* commands like mem or register dump */ | 106 | BYTE PcCommandText[1]; |
111 | WORD PcSubAddr; /* Address for command */ | 107 | BYTE __crud__[20]; |
112 | BYTE PcSubData[64]; /* Date area for command */ | 108 | BYTE PcIDNum2; /* It had to go somewhere! */ |
113 | } S4; | 109 | } S5; |
114 | struct | 110 | struct { |
115 | { | 111 | struct CmdHdr CmdHdr; |
116 | struct CmdHdr CmdHdr; | 112 | struct SamTop Topology[LINKS_PER_UNIT]; |
117 | BYTE PcCommandText[1]; | 113 | } S6; |
118 | BYTE __crud__[20]; | 114 | } U1; |
119 | BYTE PcIDNum2; /* It had to go somewhere! */ | ||
120 | } S5; | ||
121 | struct | ||
122 | { | ||
123 | struct CmdHdr CmdHdr; | ||
124 | struct SamTop Topology[LINKS_PER_UNIT]; | ||
125 | } S6; | ||
126 | } U1; | ||
127 | }; | 115 | }; |
128 | 116 | ||
129 | struct PktCmd_M | 117 | struct PktCmd_M { |
130 | { | 118 | union { |
131 | union | 119 | struct { |
132 | { | 120 | struct { |
133 | struct | 121 | uchar PcCommand; |
134 | { | 122 | union { |
135 | struct | 123 | uchar PcPhbNum; |
136 | { | 124 | uchar PcLinkNum; |
137 | uchar PcCommand; | 125 | uchar PcIDNum; |
138 | union | 126 | } U0; |
139 | { | 127 | } CmdHdr; |
140 | uchar PcPhbNum; | 128 | struct { |
141 | uchar PcLinkNum; | 129 | ushort NumPackets; |
142 | uchar PcIDNum; | 130 | ushort LoadBase; |
143 | } U0; | 131 | ushort CodeSize; |
144 | } CmdHdr; | 132 | } PcBootSequence; |
145 | struct | 133 | } S1; |
146 | { | 134 | struct { |
147 | ushort NumPackets; | 135 | ushort PcSequence; |
148 | ushort LoadBase; | 136 | uchar PcBootData[RTA_BOOT_DATA_SIZE]; |
149 | ushort CodeSize; | 137 | } S2; |
150 | } PcBootSequence; | 138 | struct { |
151 | } S1; | 139 | ushort __crud__; |
152 | struct | 140 | uchar PcUniqNum[4]; /* this is really a uint. */ |
153 | { | 141 | uchar PcModuleTypes; /* what modules are fitted */ |
154 | ushort PcSequence; | 142 | } S3; |
155 | uchar PcBootData[RTA_BOOT_DATA_SIZE]; | 143 | struct { |
156 | } S2; | 144 | ushort __cmd_hdr__; |
157 | struct | 145 | uchar __undefined__; |
158 | { | 146 | uchar PcModemStatus; |
159 | ushort __crud__; | 147 | uchar PcPortStatus; |
160 | uchar PcUniqNum[4]; /* this is really a uint. */ | 148 | uchar PcSubCommand; |
161 | uchar PcModuleTypes; /* what modules are fitted */ | 149 | ushort PcSubAddr; |
162 | } S3; | 150 | uchar PcSubData[64]; |
163 | struct | 151 | } S4; |
164 | { | 152 | struct { |
165 | ushort __cmd_hdr__; | 153 | ushort __cmd_hdr__; |
166 | uchar __undefined__; | 154 | uchar PcCommandText[1]; |
167 | uchar PcModemStatus; | 155 | uchar __crud__[20]; |
168 | uchar PcPortStatus; | 156 | uchar PcIDNum2; /* Tacked on end */ |
169 | uchar PcSubCommand; | 157 | } S5; |
170 | ushort PcSubAddr; | 158 | struct { |
171 | uchar PcSubData[64]; | 159 | ushort __cmd_hdr__; |
172 | } S4; | 160 | struct Top Topology[LINKS_PER_UNIT]; |
173 | struct | 161 | } S6; |
174 | { | 162 | } U1; |
175 | ushort __cmd_hdr__; | ||
176 | uchar PcCommandText[1]; | ||
177 | uchar __crud__[20]; | ||
178 | uchar PcIDNum2; /* Tacked on end */ | ||
179 | } S5; | ||
180 | struct | ||
181 | { | ||
182 | ushort __cmd_hdr__; | ||
183 | struct Top Topology[LINKS_PER_UNIT]; | ||
184 | } S6; | ||
185 | } U1; | ||
186 | }; | 163 | }; |
187 | 164 | ||
188 | #define Command U1.S1.CmdHdr.PcCommand | 165 | #define Command U1.S1.CmdHdr.PcCommand |
diff --git a/drivers/char/rio/control.h b/drivers/char/rio/control.h index 1712f6261dd1..6853d03304a3 100644 --- a/drivers/char/rio/control.h +++ b/drivers/char/rio/control.h | |||
@@ -51,12 +51,11 @@ | |||
51 | #define UFOAD ( CONTROL + 4 ) | 51 | #define UFOAD ( CONTROL + 4 ) |
52 | #define IWAIT ( CONTROL + 5 ) | 52 | #define IWAIT ( CONTROL + 5 ) |
53 | 53 | ||
54 | #define IFOAD_MAGIC 0xF0AD /* of course */ | 54 | #define IFOAD_MAGIC 0xF0AD /* of course */ |
55 | #define ZOMBIE_MAGIC (~0xDEAD) /* not dead -> zombie */ | 55 | #define ZOMBIE_MAGIC (~0xDEAD) /* not dead -> zombie */ |
56 | #define UFOAD_MAGIC 0xD1E /* kill-your-neighbour */ | 56 | #define UFOAD_MAGIC 0xD1E /* kill-your-neighbour */ |
57 | #define IWAIT_MAGIC 0xB1DE /* Bide your time */ | 57 | #define IWAIT_MAGIC 0xB1DE /* Bide your time */ |
58 | 58 | ||
59 | #endif | 59 | #endif |
60 | 60 | ||
61 | /*********** end of file ***********/ | 61 | /*********** end of file ***********/ |
62 | |||
diff --git a/drivers/char/rio/daemon.h b/drivers/char/rio/daemon.h index 62dba0e68b3e..28a991bd4fe6 100644 --- a/drivers/char/rio/daemon.h +++ b/drivers/char/rio/daemon.h | |||
@@ -44,18 +44,16 @@ static char *_daemon_h_sccs_ = "@(#)daemon.h 1.3"; | |||
44 | ** structures used on /dev/rio | 44 | ** structures used on /dev/rio |
45 | */ | 45 | */ |
46 | 46 | ||
47 | struct Error | 47 | struct Error { |
48 | { | 48 | uint Error; |
49 | uint Error; | 49 | uint Entry; |
50 | uint Entry; | 50 | uint Other; |
51 | uint Other; | ||
52 | }; | 51 | }; |
53 | 52 | ||
54 | struct DownLoad | 53 | struct DownLoad { |
55 | { | 54 | char *DataP; |
56 | char *DataP; | 55 | uint Count; |
57 | uint Count; | 56 | uint ProductCode; |
58 | uint ProductCode; | ||
59 | }; | 57 | }; |
60 | 58 | ||
61 | /* | 59 | /* |
@@ -66,46 +64,41 @@ struct DownLoad | |||
66 | #endif | 64 | #endif |
67 | 65 | ||
68 | #ifndef MAX_XP_CTRL_LEN | 66 | #ifndef MAX_XP_CTRL_LEN |
69 | #define MAX_XP_CTRL_LEN 16 /* ALSO IN PORT.H */ | 67 | #define MAX_XP_CTRL_LEN 16 /* ALSO IN PORT.H */ |
70 | #endif | 68 | #endif |
71 | 69 | ||
72 | struct PortSetup | 70 | struct PortSetup { |
73 | { | 71 | uint From; /* Set/Clear XP & IXANY Control from this port.... */ |
74 | uint From; /* Set/Clear XP & IXANY Control from this port.... */ | 72 | uint To; /* .... to this port */ |
75 | uint To; /* .... to this port */ | 73 | uint XpCps; /* at this speed */ |
76 | uint XpCps; /* at this speed */ | 74 | char XpOn[MAX_XP_CTRL_LEN]; /* this is the start string */ |
77 | char XpOn[MAX_XP_CTRL_LEN]; /* this is the start string */ | 75 | char XpOff[MAX_XP_CTRL_LEN]; /* this is the stop string */ |
78 | char XpOff[MAX_XP_CTRL_LEN]; /* this is the stop string */ | 76 | uchar IxAny; /* enable/disable IXANY */ |
79 | uchar IxAny; /* enable/disable IXANY */ | 77 | uchar IxOn; /* enable/disable IXON */ |
80 | uchar IxOn; /* enable/disable IXON */ | 78 | uchar Lock; /* lock port params */ |
81 | uchar Lock; /* lock port params */ | 79 | uchar Store; /* store params across closes */ |
82 | uchar Store; /* store params across closes */ | 80 | uchar Drain; /* close only when drained */ |
83 | uchar Drain; /* close only when drained */ | ||
84 | }; | 81 | }; |
85 | 82 | ||
86 | struct LpbReq | 83 | struct LpbReq { |
87 | { | 84 | uint Host; |
88 | uint Host; | 85 | uint Link; |
89 | uint Link; | 86 | struct LPB *LpbP; |
90 | struct LPB *LpbP; | ||
91 | }; | 87 | }; |
92 | 88 | ||
93 | struct RupReq | 89 | struct RupReq { |
94 | { | 90 | uint HostNum; |
95 | uint HostNum; | 91 | uint RupNum; |
96 | uint RupNum; | 92 | struct RUP *RupP; |
97 | struct RUP *RupP; | ||
98 | }; | 93 | }; |
99 | 94 | ||
100 | struct PortReq | 95 | struct PortReq { |
101 | { | 96 | uint SysPort; |
102 | uint SysPort; | 97 | struct Port *PortP; |
103 | struct Port *PortP; | ||
104 | }; | 98 | }; |
105 | 99 | ||
106 | struct StreamInfo | 100 | struct StreamInfo { |
107 | { | 101 | uint SysPort; |
108 | uint SysPort; | ||
109 | #if 0 | 102 | #if 0 |
110 | queue_t RQueue; | 103 | queue_t RQueue; |
111 | queue_t WQueue; | 104 | queue_t WQueue; |
@@ -115,68 +108,59 @@ struct StreamInfo | |||
115 | #endif | 108 | #endif |
116 | }; | 109 | }; |
117 | 110 | ||
118 | struct HostReq | 111 | struct HostReq { |
119 | { | 112 | uint HostNum; |
120 | uint HostNum; | 113 | struct Host *HostP; |
121 | struct Host *HostP; | ||
122 | }; | 114 | }; |
123 | 115 | ||
124 | struct HostDpRam | 116 | struct HostDpRam { |
125 | { | 117 | uint HostNum; |
126 | uint HostNum; | 118 | struct DpRam *DpRamP; |
127 | struct DpRam *DpRamP; | ||
128 | }; | 119 | }; |
129 | 120 | ||
130 | struct DebugCtrl | 121 | struct DebugCtrl { |
131 | { | 122 | uint SysPort; |
132 | uint SysPort; | 123 | uint Debug; |
133 | uint Debug; | 124 | uint Wait; |
134 | uint Wait; | ||
135 | }; | 125 | }; |
136 | 126 | ||
137 | struct MapInfo | 127 | struct MapInfo { |
138 | { | 128 | uint FirstPort; /* 8 ports, starting from this (tty) number */ |
139 | uint FirstPort; /* 8 ports, starting from this (tty) number */ | 129 | uint RtaUnique; /* reside on this RTA (unique number) */ |
140 | uint RtaUnique; /* reside on this RTA (unique number) */ | ||
141 | }; | 130 | }; |
142 | 131 | ||
143 | struct MapIn | 132 | struct MapIn { |
144 | { | 133 | uint NumEntries; /* How many port sets are we mapping? */ |
145 | uint NumEntries; /* How many port sets are we mapping? */ | 134 | struct MapInfo *MapInfoP; /* Pointer to (user space) info */ |
146 | struct MapInfo *MapInfoP; /* Pointer to (user space) info */ | ||
147 | }; | 135 | }; |
148 | 136 | ||
149 | struct SendPack | 137 | struct SendPack { |
150 | { | 138 | unsigned int PortNum; |
151 | unsigned int PortNum; | 139 | unsigned char Len; |
152 | unsigned char Len; | 140 | unsigned char Data[PKT_MAX_DATA_LEN]; |
153 | unsigned char Data[PKT_MAX_DATA_LEN]; | ||
154 | }; | 141 | }; |
155 | 142 | ||
156 | struct SpecialRupCmd | 143 | struct SpecialRupCmd { |
157 | { | 144 | struct PKT Packet; |
158 | struct PKT Packet; | 145 | unsigned short Host; |
159 | unsigned short Host; | 146 | unsigned short RupNum; |
160 | unsigned short RupNum; | ||
161 | }; | 147 | }; |
162 | 148 | ||
163 | struct IdentifyRta | 149 | struct IdentifyRta { |
164 | { | 150 | ulong RtaUnique; |
165 | ulong RtaUnique; | 151 | uchar ID; |
166 | uchar ID; | ||
167 | }; | 152 | }; |
168 | 153 | ||
169 | struct KillNeighbour | 154 | struct KillNeighbour { |
170 | { | 155 | ulong UniqueNum; |
171 | ulong UniqueNum; | 156 | uchar Link; |
172 | uchar Link; | ||
173 | }; | 157 | }; |
174 | 158 | ||
175 | struct rioVersion { | 159 | struct rioVersion { |
176 | char version[MAX_VERSION_LEN]; | 160 | char version[MAX_VERSION_LEN]; |
177 | char relid[MAX_VERSION_LEN]; | 161 | char relid[MAX_VERSION_LEN]; |
178 | int buildLevel; | 162 | int buildLevel; |
179 | char buildDate[MAX_VERSION_LEN]; | 163 | char buildDate[MAX_VERSION_LEN]; |
180 | }; | 164 | }; |
181 | 165 | ||
182 | 166 | ||
@@ -316,16 +300,16 @@ struct rioVersion { | |||
316 | #define RIO_SET_XP_CPS rIOCW(155,int) | 300 | #define RIO_SET_XP_CPS rIOCW(155,int) |
317 | #define RIO_GET_IXANY rIOCR(156,int) /* ixany allowed? */ | 301 | #define RIO_GET_IXANY rIOCR(156,int) /* ixany allowed? */ |
318 | #define RIO_SET_IXANY rIOCW(157,int) | 302 | #define RIO_SET_IXANY rIOCW(157,int) |
319 | #define RIO_SET_IXANY_ON rIOCN(158) /* allow ixany */ | 303 | #define RIO_SET_IXANY_ON rIOCN(158) /* allow ixany */ |
320 | #define RIO_SET_IXANY_OFF rIOCN(159) /* disallow ixany */ | 304 | #define RIO_SET_IXANY_OFF rIOCN(159) /* disallow ixany */ |
321 | #define RIO_GET_MODEM rIOCR(160,int) /* port is modem/direct line? */ | 305 | #define RIO_GET_MODEM rIOCR(160,int) /* port is modem/direct line? */ |
322 | #define RIO_SET_MODEM rIOCW(161,int) | 306 | #define RIO_SET_MODEM rIOCW(161,int) |
323 | #define RIO_SET_MODEM_ON rIOCN(162) /* port is a modem */ | 307 | #define RIO_SET_MODEM_ON rIOCN(162) /* port is a modem */ |
324 | #define RIO_SET_MODEM_OFF rIOCN(163) /* port is direct */ | 308 | #define RIO_SET_MODEM_OFF rIOCN(163) /* port is direct */ |
325 | #define RIO_GET_IXON rIOCR(164,int) /* ixon allowed? */ | 309 | #define RIO_GET_IXON rIOCR(164,int) /* ixon allowed? */ |
326 | #define RIO_SET_IXON rIOCW(165,int) | 310 | #define RIO_SET_IXON rIOCW(165,int) |
327 | #define RIO_SET_IXON_ON rIOCN(166) /* allow ixon */ | 311 | #define RIO_SET_IXON_ON rIOCN(166) /* allow ixon */ |
328 | #define RIO_SET_IXON_OFF rIOCN(167) /* disallow ixon */ | 312 | #define RIO_SET_IXON_OFF rIOCN(167) /* disallow ixon */ |
329 | 313 | ||
330 | #define RIO_GET_SIVIEW ((('s')<<8) | 106) /* backwards compatible with SI */ | 314 | #define RIO_GET_SIVIEW ((('s')<<8) | 106) /* backwards compatible with SI */ |
331 | 315 | ||
diff --git a/drivers/char/rio/debug.h b/drivers/char/rio/debug.h index b6e0d0935552..6ae95c00db4a 100644 --- a/drivers/char/rio/debug.h +++ b/drivers/char/rio/debug.h | |||
@@ -33,7 +33,7 @@ | |||
33 | #define DBPACKET(pkt, opt, str, chn) debug_packet((pkt), (opt), (str), (chn)) | 33 | #define DBPACKET(pkt, opt, str, chn) debug_packet((pkt), (opt), (str), (chn)) |
34 | #else | 34 | #else |
35 | #define DBPACKET(pkt, opt, str, c) | 35 | #define DBPACKET(pkt, opt, str, c) |
36 | #endif /* DCIRRUS */ | 36 | #endif /* DCIRRUS */ |
37 | 37 | ||
38 | 38 | ||
39 | #endif /* _debug_h_ */ | 39 | #endif /* _debug_h_ */ |
diff --git a/drivers/char/rio/defaults.h b/drivers/char/rio/defaults.h index 2e7309e27622..5b600c32ac02 100644 --- a/drivers/char/rio/defaults.h +++ b/drivers/char/rio/defaults.h | |||
@@ -37,13 +37,13 @@ | |||
37 | 37 | ||
38 | #ifndef lint | 38 | #ifndef lint |
39 | #ifdef SCCS | 39 | #ifdef SCCS |
40 | static char *_rio_defaults_h_sccs = "@(#)defaults.h 1.1" ; | 40 | static char *_rio_defaults_h_sccs = "@(#)defaults.h 1.1"; |
41 | #endif | 41 | #endif |
42 | #endif | 42 | #endif |
43 | 43 | ||
44 | 44 | ||
45 | #define MILLISECOND (int) (1000/64) /* 15.625 low ticks */ | 45 | #define MILLISECOND (int) (1000/64) /* 15.625 low ticks */ |
46 | #define SECOND (int) 15625 /* Low priority ticks */ | 46 | #define SECOND (int) 15625 /* Low priority ticks */ |
47 | 47 | ||
48 | #ifdef RTA | 48 | #ifdef RTA |
49 | #define RX_LIMIT (ushort) 3 | 49 | #define RX_LIMIT (ushort) 3 |
@@ -56,4 +56,3 @@ static char *_rio_defaults_h_sccs = "@(#)defaults.h 1.1" ; | |||
56 | 56 | ||
57 | 57 | ||
58 | /*********** end of file ***********/ | 58 | /*********** end of file ***********/ |
59 | |||
diff --git a/drivers/char/rio/eisa.h b/drivers/char/rio/eisa.h index 59371b0528b0..c2abaf0eab04 100644 --- a/drivers/char/rio/eisa.h +++ b/drivers/char/rio/eisa.h | |||
@@ -60,7 +60,7 @@ static char *_eisa_h_sccs_ = "@(#)eisa.h 1.2"; | |||
60 | 60 | ||
61 | #define EISA_PRODUCT_IDENT_LO 0xC80 /* where RIO_EISA_IDENT is */ | 61 | #define EISA_PRODUCT_IDENT_LO 0xC80 /* where RIO_EISA_IDENT is */ |
62 | #define EISA_PRODUCT_IDENT_HI 0xC81 | 62 | #define EISA_PRODUCT_IDENT_HI 0xC81 |
63 | #define EISA_PRODUCT_NUMBER 0xC82 /* where PROD_CODE is */ | 63 | #define EISA_PRODUCT_NUMBER 0xC82 /* where PROD_CODE is */ |
64 | #define EISA_REVISION_NUMBER 0xC83 /* revision (1dp) */ | 64 | #define EISA_REVISION_NUMBER 0xC83 /* revision (1dp) */ |
65 | #define EISA_ENABLE 0xC84 /* set LSB to enable card */ | 65 | #define EISA_ENABLE 0xC84 /* set LSB to enable card */ |
66 | #define EISA_UNIQUE_NUM_0 0xC88 /* vomit */ | 66 | #define EISA_UNIQUE_NUM_0 0xC88 /* vomit */ |
@@ -101,4 +101,4 @@ static char *_eisa_h_sccs_ = "@(#)eisa.h 1.2"; | |||
101 | #define INBZ(z,x) inb(((z)<<12) | (x)) | 101 | #define INBZ(z,x) inb(((z)<<12) | (x)) |
102 | #define OUTBZ(z,x,y) outb((((z)<<12) | (x)), y) | 102 | #define OUTBZ(z,x,y) outb((((z)<<12) | (x)), y) |
103 | 103 | ||
104 | #endif /* __rio_eisa_h__ */ | 104 | #endif /* __rio_eisa_h__ */ |
diff --git a/drivers/char/rio/enable.h b/drivers/char/rio/enable.h index 8e9a419e15b0..e06673fa48cf 100644 --- a/drivers/char/rio/enable.h +++ b/drivers/char/rio/enable.h | |||
@@ -36,7 +36,7 @@ | |||
36 | 36 | ||
37 | #ifndef lint | 37 | #ifndef lint |
38 | #ifdef SCCS | 38 | #ifdef SCCS |
39 | static char *_rio_enable_h_sccs = "@(#)enable.h 1.1" ; | 39 | static char *_rio_enable_h_sccs = "@(#)enable.h 1.1"; |
40 | #endif | 40 | #endif |
41 | #endif | 41 | #endif |
42 | 42 | ||
@@ -46,5 +46,3 @@ static char *_rio_enable_h_sccs = "@(#)enable.h 1.1" ; | |||
46 | 46 | ||
47 | 47 | ||
48 | /*********** end of file ***********/ | 48 | /*********** end of file ***********/ |
49 | |||
50 | |||
diff --git a/drivers/char/rio/error.h b/drivers/char/rio/error.h index 229438e355f2..f20f0789db8f 100644 --- a/drivers/char/rio/error.h +++ b/drivers/char/rio/error.h | |||
@@ -80,6 +80,3 @@ | |||
80 | 80 | ||
81 | 81 | ||
82 | /*********** end of file ***********/ | 82 | /*********** end of file ***********/ |
83 | |||
84 | |||
85 | |||
diff --git a/drivers/char/rio/errors.h b/drivers/char/rio/errors.h index f920b9f3e2bd..1d0d89144337 100644 --- a/drivers/char/rio/errors.h +++ b/drivers/char/rio/errors.h | |||
@@ -101,4 +101,4 @@ static char *_errors_h_sccs_ = "@(#)errors.h 1.2"; | |||
101 | #define NOT_ENOUGH_CORE_FOR_PCI_COPY 53 | 101 | #define NOT_ENOUGH_CORE_FOR_PCI_COPY 53 |
102 | 102 | ||
103 | 103 | ||
104 | #endif /* __rio_errors_h__ */ | 104 | #endif /* __rio_errors_h__ */ |
diff --git a/drivers/char/rio/formpkt.h b/drivers/char/rio/formpkt.h index a8b65ae0de90..3c7c91ace3ee 100644 --- a/drivers/char/rio/formpkt.h +++ b/drivers/char/rio/formpkt.h | |||
@@ -41,114 +41,113 @@ | |||
41 | 41 | ||
42 | #ifndef lint | 42 | #ifndef lint |
43 | #ifdef SCCS | 43 | #ifdef SCCS |
44 | static char *_rio_formpkt_h_sccs = "@(#)formpkt.h 1.1" ; | 44 | static char *_rio_formpkt_h_sccs = "@(#)formpkt.h 1.1"; |
45 | #endif | 45 | #endif |
46 | #endif | 46 | #endif |
47 | 47 | ||
48 | typedef struct FORM_BOOT_PKT_1 FORM_BOOT_PKT_1 ; | 48 | typedef struct FORM_BOOT_PKT_1 FORM_BOOT_PKT_1; |
49 | struct FORM_BOOT_PKT_1 { | 49 | struct FORM_BOOT_PKT_1 { |
50 | ushort pkt_number ; | 50 | ushort pkt_number; |
51 | ushort pkt_total ; | 51 | ushort pkt_total; |
52 | ushort boot_top ; | 52 | ushort boot_top; |
53 | } ; | 53 | }; |
54 | 54 | ||
55 | typedef struct FORM_BOOT_PKT_2 FORM_BOOT_PKT_2 ; | 55 | typedef struct FORM_BOOT_PKT_2 FORM_BOOT_PKT_2; |
56 | struct FORM_BOOT_PKT_2 { | 56 | struct FORM_BOOT_PKT_2 { |
57 | ushort pkt_number ; | 57 | ushort pkt_number; |
58 | char boot_data[10] ; | 58 | char boot_data[10]; |
59 | } ; | 59 | }; |
60 | 60 | ||
61 | 61 | ||
62 | typedef struct FORM_ATTACH_RTA FORM_ATTACH_RTA ; | 62 | typedef struct FORM_ATTACH_RTA FORM_ATTACH_RTA; |
63 | struct FORM_ATTACH_RTA { | 63 | struct FORM_ATTACH_RTA { |
64 | char cmd_code ; | 64 | char cmd_code; |
65 | char booter_serial[4] ; | 65 | char booter_serial[4]; |
66 | char booter_link ; | 66 | char booter_link; |
67 | char bootee_serial[4] ; | 67 | char bootee_serial[4]; |
68 | char bootee_link ; | 68 | char bootee_link; |
69 | } ; | 69 | }; |
70 | 70 | ||
71 | 71 | ||
72 | typedef struct FORM_BOOT_ID FORM_BOOT_ID ; | 72 | typedef struct FORM_BOOT_ID FORM_BOOT_ID; |
73 | struct FORM_BOOT_ID { | 73 | struct FORM_BOOT_ID { |
74 | char cmd_code ; | 74 | char cmd_code; |
75 | char bootee_serial[4] ; | 75 | char bootee_serial[4]; |
76 | char bootee_prod_id ; | 76 | char bootee_prod_id; |
77 | char bootee_link ; | 77 | char bootee_link; |
78 | } ; | 78 | }; |
79 | 79 | ||
80 | 80 | ||
81 | 81 | ||
82 | typedef struct FORM_ROUTE_1 FORM_ROUTE_1 ; | 82 | typedef struct FORM_ROUTE_1 FORM_ROUTE_1; |
83 | struct FORM_ROUTE_1 { | 83 | struct FORM_ROUTE_1 { |
84 | char cmd_code ; | 84 | char cmd_code; |
85 | char pkt_number ; | 85 | char pkt_number; |
86 | char total_in_sequence ; | 86 | char total_in_sequence; |
87 | char unit_id ; | 87 | char unit_id; |
88 | char host_unit_id ; | 88 | char host_unit_id; |
89 | } ; | 89 | }; |
90 | 90 | ||
91 | typedef struct FORM_ROUTE_2 FORM_ROUTE_2 ; | 91 | typedef struct FORM_ROUTE_2 FORM_ROUTE_2; |
92 | struct FORM_ROUTE_2 { | 92 | struct FORM_ROUTE_2 { |
93 | char cmd_code ; | 93 | char cmd_code; |
94 | char pkt_number ; | 94 | char pkt_number; |
95 | char total_in_sequence ; | 95 | char total_in_sequence; |
96 | char route_data[9] ; | 96 | char route_data[9]; |
97 | } ; | 97 | }; |
98 | 98 | ||
99 | typedef struct FORM_ROUTE_REQ FORM_ROUTE_REQ ; | 99 | typedef struct FORM_ROUTE_REQ FORM_ROUTE_REQ; |
100 | struct FORM_ROUTE_REQ { | 100 | struct FORM_ROUTE_REQ { |
101 | char cmd_code ; | 101 | char cmd_code; |
102 | char pkt_number ; | 102 | char pkt_number; |
103 | char total_in_sequence ; | 103 | char total_in_sequence; |
104 | char route_data[10] ; | 104 | char route_data[10]; |
105 | } ; | 105 | }; |
106 | 106 | ||
107 | 107 | ||
108 | typedef struct FORM_ERROR FORM_ERROR ; | 108 | typedef struct FORM_ERROR FORM_ERROR; |
109 | struct FORM_ERROR { | 109 | struct FORM_ERROR { |
110 | char cmd_code ; | 110 | char cmd_code; |
111 | char error_code ; | 111 | char error_code; |
112 | 112 | ||
113 | } ; | 113 | }; |
114 | 114 | ||
115 | typedef struct FORM_STATUS FORM_STATUS ; | 115 | typedef struct FORM_STATUS FORM_STATUS; |
116 | struct FORM_STATUS { | 116 | struct FORM_STATUS { |
117 | char cmd_code ; | 117 | char cmd_code; |
118 | char status_code ; | 118 | char status_code; |
119 | char last_packet_valid ; | 119 | char last_packet_valid; |
120 | char tx_buffer ; | 120 | char tx_buffer; |
121 | char rx_buffer ; | 121 | char rx_buffer; |
122 | char port_status ; | 122 | char port_status; |
123 | char phb_status ; | 123 | char phb_status; |
124 | } ; | 124 | }; |
125 | 125 | ||
126 | 126 | ||
127 | typedef struct FORM_LINK_STATUS FORM_LINK_STATUS ; | 127 | typedef struct FORM_LINK_STATUS FORM_LINK_STATUS; |
128 | struct FORM_LINK_STATUS { | 128 | struct FORM_LINK_STATUS { |
129 | char cmd_code ; | 129 | char cmd_code; |
130 | char status_code ; | 130 | char status_code; |
131 | char link_number ; | 131 | char link_number; |
132 | ushort rx_errors ; | 132 | ushort rx_errors; |
133 | ushort tx_errors ; | 133 | ushort tx_errors; |
134 | ushort csum_errors ; | 134 | ushort csum_errors; |
135 | ushort disconnects ; | 135 | ushort disconnects; |
136 | } ; | 136 | }; |
137 | 137 | ||
138 | 138 | ||
139 | 139 | ||
140 | typedef struct FORM_PARTITION FORM_PARTITION ; | 140 | typedef struct FORM_PARTITION FORM_PARTITION; |
141 | struct FORM_PARTITION { | 141 | struct FORM_PARTITION { |
142 | char cmd_code ; | 142 | char cmd_code; |
143 | char status_code ; | 143 | char status_code; |
144 | char port_number ; | 144 | char port_number; |
145 | char tx_max ; | 145 | char tx_max; |
146 | char rx_max ; | 146 | char rx_max; |
147 | char rx_limit ; | 147 | char rx_limit; |
148 | } ; | 148 | }; |
149 | 149 | ||
150 | 150 | ||
151 | #endif | 151 | #endif |
152 | 152 | ||
153 | /*********** end of file ***********/ | 153 | /*********** end of file ***********/ |
154 | |||
diff --git a/drivers/char/rio/func.h b/drivers/char/rio/func.h index 01987c6dc398..b4778410ec6e 100644 --- a/drivers/char/rio/func.h +++ b/drivers/char/rio/func.h | |||
@@ -47,20 +47,19 @@ int RIOBootCodeHOST(struct rio_info *, register struct DownLoad *); | |||
47 | int RIOBootCodeUNKNOWN(struct rio_info *, struct DownLoad *); | 47 | int RIOBootCodeUNKNOWN(struct rio_info *, struct DownLoad *); |
48 | void msec_timeout(struct Host *); | 48 | void msec_timeout(struct Host *); |
49 | int RIOBootRup(struct rio_info *, uint, struct Host *, struct PKT *); | 49 | int RIOBootRup(struct rio_info *, uint, struct Host *, struct PKT *); |
50 | int RIOBootOk(struct rio_info *,struct Host *, ulong); | 50 | int RIOBootOk(struct rio_info *, struct Host *, ulong); |
51 | int RIORtaBound(struct rio_info *, uint); | 51 | int RIORtaBound(struct rio_info *, uint); |
52 | void FillSlot(int, int, uint, struct Host *); | 52 | void FillSlot(int, int, uint, struct Host *); |
53 | 53 | ||
54 | /* riocmd.c */ | 54 | /* riocmd.c */ |
55 | int RIOFoadRta(struct Host *, struct Map *); | 55 | int RIOFoadRta(struct Host *, struct Map *); |
56 | int RIOZombieRta(struct Host *, struct Map *); | 56 | int RIOZombieRta(struct Host *, struct Map *); |
57 | int RIOCommandRta(struct rio_info *, uint, int (* func)( struct Host *, | 57 | int RIOCommandRta(struct rio_info *, uint, int (*func) (struct Host *, struct Map *)); |
58 | struct Map *)); | 58 | int RIOIdentifyRta(struct rio_info *, caddr_t); |
59 | int RIOIdentifyRta(struct rio_info *, caddr_t); | ||
60 | int RIOKillNeighbour(struct rio_info *, caddr_t); | 59 | int RIOKillNeighbour(struct rio_info *, caddr_t); |
61 | int RIOSuspendBootRta(struct Host *, int, int); | 60 | int RIOSuspendBootRta(struct Host *, int, int); |
62 | int RIOFoadWakeup(struct rio_info *); | 61 | int RIOFoadWakeup(struct rio_info *); |
63 | struct CmdBlk * RIOGetCmdBlk(void); | 62 | struct CmdBlk *RIOGetCmdBlk(void); |
64 | void RIOFreeCmdBlk(struct CmdBlk *); | 63 | void RIOFreeCmdBlk(struct CmdBlk *); |
65 | int RIOQueueCmdBlk(struct Host *, uint, struct CmdBlk *); | 64 | int RIOQueueCmdBlk(struct Host *, uint, struct CmdBlk *); |
66 | void RIOPollHostCommands(struct rio_info *, struct Host *); | 65 | void RIOPollHostCommands(struct rio_info *, struct Host *); |
@@ -71,13 +70,13 @@ void ShowPacket(uint, struct PKT *); | |||
71 | 70 | ||
72 | /* rioctrl.c */ | 71 | /* rioctrl.c */ |
73 | int copyin(int, caddr_t, int); | 72 | int copyin(int, caddr_t, int); |
74 | int riocontrol(struct rio_info *, dev_t,int,caddr_t,int); | 73 | int riocontrol(struct rio_info *, dev_t, int, caddr_t, int); |
75 | int RIOPreemptiveCmd(struct rio_info *,struct Port *,uchar); | 74 | int RIOPreemptiveCmd(struct rio_info *, struct Port *, uchar); |
76 | 75 | ||
77 | /* rioinit.c */ | 76 | /* rioinit.c */ |
78 | void rioinit(struct rio_info *, struct RioHostInfo *); | 77 | void rioinit(struct rio_info *, struct RioHostInfo *); |
79 | void RIOInitHosts(struct rio_info *, struct RioHostInfo *); | 78 | void RIOInitHosts(struct rio_info *, struct RioHostInfo *); |
80 | void RIOISAinit(struct rio_info *,int); | 79 | void RIOISAinit(struct rio_info *, int); |
81 | int RIODoAT(struct rio_info *, int, int); | 80 | int RIODoAT(struct rio_info *, int, int); |
82 | caddr_t RIOCheckForATCard(int); | 81 | caddr_t RIOCheckForATCard(int); |
83 | int RIOAssignAT(struct rio_info *, int, caddr_t, int); | 82 | int RIOAssignAT(struct rio_info *, int, caddr_t, int); |
@@ -85,7 +84,7 @@ int RIOBoardTest(paddr_t, caddr_t, uchar, int); | |||
85 | void RIOAllocDataStructs(struct rio_info *); | 84 | void RIOAllocDataStructs(struct rio_info *); |
86 | void RIOSetupDataStructs(struct rio_info *); | 85 | void RIOSetupDataStructs(struct rio_info *); |
87 | int RIODefaultName(struct rio_info *, struct Host *, uint); | 86 | int RIODefaultName(struct rio_info *, struct Host *, uint); |
88 | struct rioVersion * RIOVersid(void); | 87 | struct rioVersion *RIOVersid(void); |
89 | int RIOMapin(paddr_t, int, caddr_t *); | 88 | int RIOMapin(paddr_t, int, caddr_t *); |
90 | void RIOMapout(paddr_t, long, caddr_t); | 89 | void RIOMapout(paddr_t, long, caddr_t); |
91 | void RIOHostReset(uint, volatile struct DpRam *, uint); | 90 | void RIOHostReset(uint, volatile struct DpRam *, uint); |
@@ -108,7 +107,7 @@ void remove_receive(struct Port *); | |||
108 | 107 | ||
109 | /* rioroute.c */ | 108 | /* rioroute.c */ |
110 | int RIORouteRup(struct rio_info *, uint, struct Host *, struct PKT *); | 109 | int RIORouteRup(struct rio_info *, uint, struct Host *, struct PKT *); |
111 | void RIOFixPhbs(struct rio_info *, struct Host *, uint); | 110 | void RIOFixPhbs(struct rio_info *, struct Host *, uint); |
112 | uint GetUnitType(uint); | 111 | uint GetUnitType(uint); |
113 | int RIOSetChange(struct rio_info *); | 112 | int RIOSetChange(struct rio_info *); |
114 | int RIOFindFreeID(struct rio_info *, struct Host *, uint *, uint *); | 113 | int RIOFindFreeID(struct rio_info *, struct Host *, uint *, uint *); |
@@ -116,9 +115,9 @@ int RIOFindFreeID(struct rio_info *, struct Host *, uint *, uint *); | |||
116 | 115 | ||
117 | /* riotty.c */ | 116 | /* riotty.c */ |
118 | 117 | ||
119 | int riotopen(struct tty_struct * tty, struct file * filp); | 118 | int riotopen(struct tty_struct *tty, struct file *filp); |
120 | int riotclose(void *ptr); | 119 | int riotclose(void *ptr); |
121 | int riotioctl(struct rio_info *, struct tty_struct *, register int, register caddr_t); | 120 | int riotioctl(struct rio_info *, struct tty_struct *, register int, register caddr_t); |
122 | void ttyseth(struct Port *, struct ttystatics *, struct old_sgttyb *sg); | 121 | void ttyseth(struct Port *, struct ttystatics *, struct old_sgttyb *sg); |
123 | 122 | ||
124 | /* riotable.c */ | 123 | /* riotable.c */ |
@@ -127,27 +126,27 @@ int RIOApel(struct rio_info *); | |||
127 | int RIODeleteRta(struct rio_info *, struct Map *); | 126 | int RIODeleteRta(struct rio_info *, struct Map *); |
128 | int RIOAssignRta(struct rio_info *, struct Map *); | 127 | int RIOAssignRta(struct rio_info *, struct Map *); |
129 | int RIOReMapPorts(struct rio_info *, struct Host *, struct Map *); | 128 | int RIOReMapPorts(struct rio_info *, struct Host *, struct Map *); |
130 | int RIOChangeName(struct rio_info *, struct Map*); | 129 | int RIOChangeName(struct rio_info *, struct Map *); |
131 | 130 | ||
132 | #if 0 | 131 | #if 0 |
133 | /* riodrvr.c */ | 132 | /* riodrvr.c */ |
134 | struct rio_info * rio_install(struct RioHostInfo *); | 133 | struct rio_info *rio_install(struct RioHostInfo *); |
135 | int rio_uninstall(register struct rio_info *); | 134 | int rio_uninstall(register struct rio_info *); |
136 | int rio_open(struct rio_info *, int, struct file *); | 135 | int rio_open(struct rio_info *, int, struct file *); |
137 | int rio_close(struct rio_info *, struct file *); | 136 | int rio_close(struct rio_info *, struct file *); |
138 | int rio_read(struct rio_info *, struct file *, char *, int); | 137 | int rio_read(struct rio_info *, struct file *, char *, int); |
139 | int rio_write(struct rio_info *, struct file * f, char *, int); | 138 | int rio_write(struct rio_info *, struct file *f, char *, int); |
140 | int rio_ioctl(struct rio_info *, struct file *, int, char *); | 139 | int rio_ioctl(struct rio_info *, struct file *, int, char *); |
141 | int rio_select(struct rio_info *, struct file * f, int, struct sel *); | 140 | int rio_select(struct rio_info *, struct file *f, int, struct sel *); |
142 | int rio_intr(char *); | 141 | int rio_intr(char *); |
143 | int rio_isr_thread(char *); | 142 | int rio_isr_thread(char *); |
144 | struct rio_info * rio_info_store( int cmd, struct rio_info * p); | 143 | struct rio_info *rio_info_store(int cmd, struct rio_info *p); |
145 | #endif | 144 | #endif |
146 | 145 | ||
147 | extern int rio_pcicopy(char *src, char *dst, int n); | 146 | extern int rio_pcicopy(char *src, char *dst, int n); |
148 | extern int rio_minor (struct tty_struct *tty); | 147 | extern int rio_minor(struct tty_struct *tty); |
149 | extern int rio_ismodem (struct tty_struct *tty); | 148 | extern int rio_ismodem(struct tty_struct *tty); |
150 | 149 | ||
151 | extern void rio_start_card_running (struct Host * HostP); | 150 | extern void rio_start_card_running(struct Host *HostP); |
152 | 151 | ||
153 | #endif /* __func_h_def */ | 152 | #endif /* __func_h_def */ |
diff --git a/drivers/char/rio/host.h b/drivers/char/rio/host.h index 4c65963870a4..f7dfcedf7d45 100644 --- a/drivers/char/rio/host.h +++ b/drivers/char/rio/host.h | |||
@@ -49,33 +49,32 @@ static char *_host_h_sccs_ = "@(#)host.h 1.2"; | |||
49 | ** Host data structure. This is used for the software equiv. of | 49 | ** Host data structure. This is used for the software equiv. of |
50 | ** the host. | 50 | ** the host. |
51 | */ | 51 | */ |
52 | struct Host | 52 | struct Host { |
53 | { | 53 | uchar Type; /* RIO_EISA, RIO_MCA, ... */ |
54 | uchar Type; /* RIO_EISA, RIO_MCA, ... */ | 54 | uchar Ivec; /* POLLED or ivec number */ |
55 | uchar Ivec; /* POLLED or ivec number */ | 55 | uchar Mode; /* Control stuff */ |
56 | uchar Mode; /* Control stuff */ | 56 | uchar Slot; /* Slot */ |
57 | uchar Slot; /* Slot */ | 57 | volatile caddr_t Caddr; /* KV address of DPRAM */ |
58 | volatile caddr_t Caddr; /* KV address of DPRAM */ | 58 | volatile struct DpRam *CardP; /* KV address of DPRAM, with overlay */ |
59 | volatile struct DpRam *CardP; /* KV address of DPRAM, with overlay */ | 59 | paddr_t PaddrP; /* Phys. address of DPRAM */ |
60 | paddr_t PaddrP; /* Phys. address of DPRAM */ | 60 | char Name[MAX_NAME_LEN]; /* The name of the host */ |
61 | char Name[MAX_NAME_LEN]; /* The name of the host */ | 61 | uint UniqueNum; /* host unique number */ |
62 | uint UniqueNum; /* host unique number */ | 62 | spinlock_t HostLock; /* Lock structure for MPX */ |
63 | spinlock_t HostLock; /* Lock structure for MPX */ | 63 | /*struct pci_devinfo PciDevInfo; *//* PCI Bus/Device/Function stuff */ |
64 | /*struct pci_devinfo PciDevInfo; *//* PCI Bus/Device/Function stuff */ | 64 | /*struct lockb HostLock; *//* Lock structure for MPX */ |
65 | /*struct lockb HostLock; *//* Lock structure for MPX */ | 65 | uint WorkToBeDone; /* set to true each interrupt */ |
66 | uint WorkToBeDone; /* set to true each interrupt */ | 66 | uint InIntr; /* Being serviced? */ |
67 | uint InIntr; /* Being serviced? */ | 67 | uint IntSrvDone; /* host's interrupt has been serviced */ |
68 | uint IntSrvDone;/* host's interrupt has been serviced */ | 68 | int (*Copy) (caddr_t, caddr_t, int); /* copy func */ |
69 | int (*Copy)( caddr_t, caddr_t, int ); /* copy func */ | 69 | struct timer_list timer; |
70 | struct timer_list timer; | 70 | /* |
71 | /* | 71 | ** I M P O R T A N T ! |
72 | ** I M P O R T A N T ! | 72 | ** |
73 | ** | 73 | ** The rest of this data structure is cleared to zero after |
74 | ** The rest of this data structure is cleared to zero after | 74 | ** a RIO_HOST_FOAD command. |
75 | ** a RIO_HOST_FOAD command. | 75 | */ |
76 | */ | 76 | |
77 | 77 | ulong Flags; /* Whats going down */ | |
78 | ulong Flags; /* Whats going down */ | ||
79 | #define RC_WAITING 0 | 78 | #define RC_WAITING 0 |
80 | #define RC_STARTUP 1 | 79 | #define RC_STARTUP 1 |
81 | #define RC_RUNNING 2 | 80 | #define RC_RUNNING 2 |
@@ -93,25 +92,25 @@ struct Host | |||
93 | #define RC_BOOT_OWN 0x10 /* Only boot RTAs bound to this system */ | 92 | #define RC_BOOT_OWN 0x10 /* Only boot RTAs bound to this system */ |
94 | #define RC_BOOT_NONE 0x20 /* Don't boot any RTAs (slave mode) */ | 93 | #define RC_BOOT_NONE 0x20 /* Don't boot any RTAs (slave mode) */ |
95 | 94 | ||
96 | struct Top Topology[LINKS_PER_UNIT]; /* one per link */ | 95 | struct Top Topology[LINKS_PER_UNIT]; /* one per link */ |
97 | struct Map Mapping[MAX_RUP]; /* Mappings for host */ | 96 | struct Map Mapping[MAX_RUP]; /* Mappings for host */ |
98 | struct PHB *PhbP; /* Pointer to the PHB array */ | 97 | struct PHB *PhbP; /* Pointer to the PHB array */ |
99 | ushort *PhbNumP; /* Ptr to Number of PHB's */ | 98 | ushort *PhbNumP; /* Ptr to Number of PHB's */ |
100 | struct LPB *LinkStrP ; /* Link Structure Array */ | 99 | struct LPB *LinkStrP; /* Link Structure Array */ |
101 | struct RUP *RupP; /* Sixteen real rups here */ | 100 | struct RUP *RupP; /* Sixteen real rups here */ |
102 | struct PARM_MAP *ParmMapP; /* points to the parmmap */ | 101 | struct PARM_MAP *ParmMapP; /* points to the parmmap */ |
103 | uint ExtraUnits[MAX_EXTRA_UNITS]; /* unknown things */ | 102 | uint ExtraUnits[MAX_EXTRA_UNITS]; /* unknown things */ |
104 | uint NumExtraBooted; /* how many of the above */ | 103 | uint NumExtraBooted; /* how many of the above */ |
105 | /* | 104 | /* |
106 | ** Twenty logical rups. | 105 | ** Twenty logical rups. |
107 | ** The first sixteen are the real Rup entries (above), the last four | 106 | ** The first sixteen are the real Rup entries (above), the last four |
108 | ** are the link RUPs. | 107 | ** are the link RUPs. |
109 | */ | 108 | */ |
110 | struct UnixRup UnixRups[MAX_RUP+LINKS_PER_UNIT]; | 109 | struct UnixRup UnixRups[MAX_RUP + LINKS_PER_UNIT]; |
111 | int timeout_id; /* For calling 100 ms delays */ | 110 | int timeout_id; /* For calling 100 ms delays */ |
112 | int timeout_sem;/* For calling 100 ms delays */ | 111 | int timeout_sem; /* For calling 100 ms delays */ |
113 | long locks; /* long req'd for set_bit --RR */ | 112 | long locks; /* long req'd for set_bit --RR */ |
114 | char ____end_marker____; | 113 | char ____end_marker____; |
115 | }; | 114 | }; |
116 | #define Control CardP->DpControl | 115 | #define Control CardP->DpControl |
117 | #define SetInt CardP->DpSetInt | 116 | #define SetInt CardP->DpSetInt |
@@ -129,6 +128,6 @@ struct Host | |||
129 | #define Year CardP->DpYear | 128 | #define Year CardP->DpYear |
130 | #define Week CardP->DpWeek | 129 | #define Week CardP->DpWeek |
131 | 130 | ||
132 | #define RIO_DUMBPARM 0x0860 /* what not to expect */ | 131 | #define RIO_DUMBPARM 0x0860 /* what not to expect */ |
133 | 132 | ||
134 | #endif | 133 | #endif |
diff --git a/drivers/char/rio/hosthw.h b/drivers/char/rio/hosthw.h index f6f31ece6e32..6281fe47f4e9 100644 --- a/drivers/char/rio/hosthw.h +++ b/drivers/char/rio/hosthw.h | |||
@@ -37,7 +37,7 @@ | |||
37 | 37 | ||
38 | #ifndef lint | 38 | #ifndef lint |
39 | #ifdef SCCS_LABELS | 39 | #ifdef SCCS_LABELS |
40 | static char *_rio_hosthw_h_sccs = "@(#)hosthw.h 1.2" ; | 40 | static char *_rio_hosthw_h_sccs = "@(#)hosthw.h 1.2"; |
41 | #endif | 41 | #endif |
42 | #endif | 42 | #endif |
43 | 43 | ||
@@ -53,5 +53,3 @@ static char *_rio_hosthw_h_sccs = "@(#)hosthw.h 1.2" ; | |||
53 | 53 | ||
54 | 54 | ||
55 | /*********** end of file ***********/ | 55 | /*********** end of file ***********/ |
56 | |||
57 | |||
diff --git a/drivers/char/rio/link.h b/drivers/char/rio/link.h index 972250348f4a..bfba5b0c033e 100644 --- a/drivers/char/rio/link.h +++ b/drivers/char/rio/link.h | |||
@@ -70,27 +70,27 @@ | |||
70 | #define DIE_NOW (ushort) 0x0200 | 70 | #define DIE_NOW (ushort) 0x0200 |
71 | 71 | ||
72 | /* Boot request stuff */ | 72 | /* Boot request stuff */ |
73 | #define BOOT_REQUEST ((ushort) 0) /* Request for a boot */ | 73 | #define BOOT_REQUEST ((ushort) 0) /* Request for a boot */ |
74 | #define BOOT_ABORT ((ushort) 1) /* Abort a boot */ | 74 | #define BOOT_ABORT ((ushort) 1) /* Abort a boot */ |
75 | #define BOOT_SEQUENCE ((ushort) 2) /* Packet with the number of packets | 75 | #define BOOT_SEQUENCE ((ushort) 2) /* Packet with the number of packets |
76 | and load address */ | 76 | and load address */ |
77 | #define BOOT_COMPLETED ((ushort) 3) /* Boot completed */ | 77 | #define BOOT_COMPLETED ((ushort) 3) /* Boot completed */ |
78 | 78 | ||
79 | /* States that a link can be in */ | 79 | /* States that a link can be in */ |
80 | #define LINK_DISCONNECTED ((ushort) 0) /* Disconnected */ | 80 | #define LINK_DISCONNECTED ((ushort) 0) /* Disconnected */ |
81 | #define LINK_BOOT1 ((ushort) 1) /* Trying to send 1st stage boot */ | 81 | #define LINK_BOOT1 ((ushort) 1) /* Trying to send 1st stage boot */ |
82 | #define LINK_BOOT2 ((ushort) 2) /* Trying to send 2nd stage boot */ | 82 | #define LINK_BOOT2 ((ushort) 2) /* Trying to send 2nd stage boot */ |
83 | #define LINK_BOOT2WAIT ((ushort) 3) /* Waiting for selftest results */ | 83 | #define LINK_BOOT2WAIT ((ushort) 3) /* Waiting for selftest results */ |
84 | #define LINK_BOOT3 ((ushort) 4) /* Trying to send 3rd stage boots */ | 84 | #define LINK_BOOT3 ((ushort) 4) /* Trying to send 3rd stage boots */ |
85 | #define LINK_SYNC ((ushort) 5) /* Syncing */ | 85 | #define LINK_SYNC ((ushort) 5) /* Syncing */ |
86 | 86 | ||
87 | #define LINK_INTRO ((ushort) 10) /* Introductory packet */ | 87 | #define LINK_INTRO ((ushort) 10) /* Introductory packet */ |
88 | #define LINK_SUPPLYID ((ushort) 11) /* Trying to supply an ID */ | 88 | #define LINK_SUPPLYID ((ushort) 11) /* Trying to supply an ID */ |
89 | #define LINK_TOPOLOGY ((ushort) 12) /* Send a topology update */ | 89 | #define LINK_TOPOLOGY ((ushort) 12) /* Send a topology update */ |
90 | #define LINK_REQUESTID ((ushort) 13) /* Waiting for an ID */ | 90 | #define LINK_REQUESTID ((ushort) 13) /* Waiting for an ID */ |
91 | #define LINK_CONNECTED ((ushort) 14) /* Connected */ | 91 | #define LINK_CONNECTED ((ushort) 14) /* Connected */ |
92 | 92 | ||
93 | #define LINK_INTERCONNECT ((ushort) 20) /* Subnets interconnected */ | 93 | #define LINK_INTERCONNECT ((ushort) 20) /* Subnets interconnected */ |
94 | 94 | ||
95 | #define LINK_SPARE ((ushort) 40) | 95 | #define LINK_SPARE ((ushort) 40) |
96 | 96 | ||
@@ -103,12 +103,12 @@ | |||
103 | ** LED stuff | 103 | ** LED stuff |
104 | */ | 104 | */ |
105 | #if defined(RTA) | 105 | #if defined(RTA) |
106 | #define LED_OFF ((ushort) 0) /* LED off */ | 106 | #define LED_OFF ((ushort) 0) /* LED off */ |
107 | #define LED_RED ((ushort) 1) /* LED Red */ | 107 | #define LED_RED ((ushort) 1) /* LED Red */ |
108 | #define LED_GREEN ((ushort) 2) /* LED Green */ | 108 | #define LED_GREEN ((ushort) 2) /* LED Green */ |
109 | #define LED_ORANGE ((ushort) 4) /* LED Orange */ | 109 | #define LED_ORANGE ((ushort) 4) /* LED Orange */ |
110 | #define LED_1TO8_OPEN ((ushort) 1) /* Port 1->8 LED on */ | 110 | #define LED_1TO8_OPEN ((ushort) 1) /* Port 1->8 LED on */ |
111 | #define LED_9TO16_OPEN ((ushort) 2) /* Port 9->16 LED on */ | 111 | #define LED_9TO16_OPEN ((ushort) 2) /* Port 9->16 LED on */ |
112 | #define LED_SET_COLOUR(colour) (link->led = (colour)) | 112 | #define LED_SET_COLOUR(colour) (link->led = (colour)) |
113 | #define LED_OR_COLOUR(colour) (link->led |= (colour)) | 113 | #define LED_OR_COLOUR(colour) (link->led |= (colour)) |
114 | #define LED_TIMEOUT(time) (link->led_timeout = RioTimePlus(RioTime(),(time))) | 114 | #define LED_TIMEOUT(time) (link->led_timeout = RioTimePlus(RioTime(),(time))) |
@@ -116,72 +116,72 @@ | |||
116 | #define LED_SET_COLOUR(colour) | 116 | #define LED_SET_COLOUR(colour) |
117 | #define LED_OR_COLOUR(colour) | 117 | #define LED_OR_COLOUR(colour) |
118 | #define LED_TIMEOUT(time) | 118 | #define LED_TIMEOUT(time) |
119 | #endif /* RTA */ | 119 | #endif /* RTA */ |
120 | 120 | ||
121 | struct LPB { | 121 | struct LPB { |
122 | WORD link_number ; /* Link Number */ | 122 | WORD link_number; /* Link Number */ |
123 | Channel_ptr in_ch ; /* Link In Channel */ | 123 | Channel_ptr in_ch; /* Link In Channel */ |
124 | Channel_ptr out_ch ; /* Link Out Channel */ | 124 | Channel_ptr out_ch; /* Link Out Channel */ |
125 | #ifdef RTA | 125 | #ifdef RTA |
126 | uchar stat_led ; /* Port open leds */ | 126 | uchar stat_led; /* Port open leds */ |
127 | uchar led ; /* True, light led! */ | 127 | uchar led; /* True, light led! */ |
128 | #endif | 128 | #endif |
129 | BYTE attached_serial[4]; /* Attached serial number */ | 129 | BYTE attached_serial[4]; /* Attached serial number */ |
130 | BYTE attached_host_serial[4]; | 130 | BYTE attached_host_serial[4]; |
131 | /* Serial number of Host who | 131 | /* Serial number of Host who |
132 | booted the other end */ | 132 | booted the other end */ |
133 | WORD descheduled ; /* Currently Descheduled */ | 133 | WORD descheduled; /* Currently Descheduled */ |
134 | WORD state; /* Current state */ | 134 | WORD state; /* Current state */ |
135 | WORD send_poll ; /* Send a Poll Packet */ | 135 | WORD send_poll; /* Send a Poll Packet */ |
136 | Process_ptr ltt_p ; /* Process Descriptor */ | 136 | Process_ptr ltt_p; /* Process Descriptor */ |
137 | Process_ptr lrt_p ; /* Process Descriptor */ | 137 | Process_ptr lrt_p; /* Process Descriptor */ |
138 | WORD lrt_status ; /* Current lrt status */ | 138 | WORD lrt_status; /* Current lrt status */ |
139 | WORD ltt_status ; /* Current ltt status */ | 139 | WORD ltt_status; /* Current ltt status */ |
140 | WORD timeout ; /* Timeout value */ | 140 | WORD timeout; /* Timeout value */ |
141 | WORD topology; /* Topology bits */ | 141 | WORD topology; /* Topology bits */ |
142 | WORD mon_ltt ; | 142 | WORD mon_ltt; |
143 | WORD mon_lrt ; | 143 | WORD mon_lrt; |
144 | WORD WaitNoBoot ; /* Secs to hold off booting */ | 144 | WORD WaitNoBoot; /* Secs to hold off booting */ |
145 | PKT_ptr add_packet_list; /* Add packets to here */ | 145 | PKT_ptr add_packet_list; /* Add packets to here */ |
146 | PKT_ptr remove_packet_list; /* Send packets from here */ | 146 | PKT_ptr remove_packet_list; /* Send packets from here */ |
147 | #ifdef RTA | 147 | #ifdef RTA |
148 | #ifdef DCIRRUS | 148 | #ifdef DCIRRUS |
149 | #define QBUFS_PER_REDIRECT (4 / PKTS_PER_BUFFER + 1) | 149 | #define QBUFS_PER_REDIRECT (4 / PKTS_PER_BUFFER + 1) |
150 | #else | 150 | #else |
151 | #define QBUFS_PER_REDIRECT (8 / PKTS_PER_BUFFER + 1) | 151 | #define QBUFS_PER_REDIRECT (8 / PKTS_PER_BUFFER + 1) |
152 | #endif | 152 | #endif |
153 | PKT_ptr_ptr rd_add ; /* Add a new Packet here */ | 153 | PKT_ptr_ptr rd_add; /* Add a new Packet here */ |
154 | Q_BUF_ptr rd_add_qb; /* Pointer to the add Q buf */ | 154 | Q_BUF_ptr rd_add_qb; /* Pointer to the add Q buf */ |
155 | PKT_ptr_ptr rd_add_st_qbb ; /* Pointer to start of the Q's buf */ | 155 | PKT_ptr_ptr rd_add_st_qbb; /* Pointer to start of the Q's buf */ |
156 | PKT_ptr_ptr rd_add_end_qbb ; /* Pointer to the end of the Q's buf */ | 156 | PKT_ptr_ptr rd_add_end_qbb; /* Pointer to the end of the Q's buf */ |
157 | PKT_ptr_ptr rd_remove ; /* Remove a Packet here */ | 157 | PKT_ptr_ptr rd_remove; /* Remove a Packet here */ |
158 | Q_BUF_ptr rd_remove_qb ; /* Pointer to the remove Q buf */ | 158 | Q_BUF_ptr rd_remove_qb; /* Pointer to the remove Q buf */ |
159 | PKT_ptr_ptr rd_remove_st_qbb ; /* Pointer to the start of the Q buf */ | 159 | PKT_ptr_ptr rd_remove_st_qbb; /* Pointer to the start of the Q buf */ |
160 | PKT_ptr_ptr rd_remove_end_qbb ; /* Pointer to the end of the Q buf */ | 160 | PKT_ptr_ptr rd_remove_end_qbb; /* Pointer to the end of the Q buf */ |
161 | ushort pkts_in_q ; /* Packets in queue */ | 161 | ushort pkts_in_q; /* Packets in queue */ |
162 | #endif | 162 | #endif |
163 | 163 | ||
164 | Channel_ptr lrt_fail_chan ; /* Lrt's failure channel */ | 164 | Channel_ptr lrt_fail_chan; /* Lrt's failure channel */ |
165 | Channel_ptr ltt_fail_chan ; /* Ltt's failure channel */ | 165 | Channel_ptr ltt_fail_chan; /* Ltt's failure channel */ |
166 | 166 | ||
167 | #if defined (HOST) || defined (INKERNEL) | 167 | #if defined (HOST) || defined (INKERNEL) |
168 | /* RUP structure for HOST to driver communications */ | 168 | /* RUP structure for HOST to driver communications */ |
169 | struct RUP rup ; | 169 | struct RUP rup; |
170 | #endif | 170 | #endif |
171 | struct RUP link_rup; /* RUP for the link (POLL, | 171 | struct RUP link_rup; /* RUP for the link (POLL, |
172 | topology etc.) */ | 172 | topology etc.) */ |
173 | WORD attached_link ; /* Number of attached link */ | 173 | WORD attached_link; /* Number of attached link */ |
174 | WORD csum_errors ; /* csum errors */ | 174 | WORD csum_errors; /* csum errors */ |
175 | WORD num_disconnects ; /* number of disconnects */ | 175 | WORD num_disconnects; /* number of disconnects */ |
176 | WORD num_sync_rcvd ; /* # sync's received */ | 176 | WORD num_sync_rcvd; /* # sync's received */ |
177 | WORD num_sync_rqst ; /* # sync requests */ | 177 | WORD num_sync_rqst; /* # sync requests */ |
178 | WORD num_tx ; /* Num pkts sent */ | 178 | WORD num_tx; /* Num pkts sent */ |
179 | WORD num_rx ; /* Num pkts received */ | 179 | WORD num_rx; /* Num pkts received */ |
180 | WORD module_attached; /* Module tpyes of attached */ | 180 | WORD module_attached; /* Module tpyes of attached */ |
181 | WORD led_timeout; /* LED timeout */ | 181 | WORD led_timeout; /* LED timeout */ |
182 | WORD first_port; /* First port to service */ | 182 | WORD first_port; /* First port to service */ |
183 | WORD last_port; /* Last port to service */ | 183 | WORD last_port; /* Last port to service */ |
184 | } ; | 184 | }; |
185 | 185 | ||
186 | #endif | 186 | #endif |
187 | 187 | ||
diff --git a/drivers/char/rio/linux_compat.h b/drivers/char/rio/linux_compat.h index d53843abe02d..17a14c4a3420 100644 --- a/drivers/char/rio/linux_compat.h +++ b/drivers/char/rio/linux_compat.h | |||
@@ -41,7 +41,7 @@ | |||
41 | #endif | 41 | #endif |
42 | 42 | ||
43 | struct ttystatics { | 43 | struct ttystatics { |
44 | struct termios tm; | 44 | struct termios tm; |
45 | }; | 45 | }; |
46 | 46 | ||
47 | #define bzero(d, n) memset((d), 0, (n)) | 47 | #define bzero(d, n) memset((d), 0, (n)) |
@@ -97,26 +97,24 @@ the older driver. The older driver includes "brates.h" which shadows | |||
97 | the definitions from Linux, and is incompatible... */ | 97 | the definitions from Linux, and is incompatible... */ |
98 | 98 | ||
99 | /* RxBaud and TxBaud definitions... */ | 99 | /* RxBaud and TxBaud definitions... */ |
100 | #define RIO_B0 0x00 /* RTS / DTR signals dropped */ | 100 | #define RIO_B0 0x00 /* RTS / DTR signals dropped */ |
101 | #define RIO_B50 0x01 /* 50 baud */ | 101 | #define RIO_B50 0x01 /* 50 baud */ |
102 | #define RIO_B75 0x02 /* 75 baud */ | 102 | #define RIO_B75 0x02 /* 75 baud */ |
103 | #define RIO_B110 0x03 /* 110 baud */ | 103 | #define RIO_B110 0x03 /* 110 baud */ |
104 | #define RIO_B134 0x04 /* 134.5 baud */ | 104 | #define RIO_B134 0x04 /* 134.5 baud */ |
105 | #define RIO_B150 0x05 /* 150 baud */ | 105 | #define RIO_B150 0x05 /* 150 baud */ |
106 | #define RIO_B200 0x06 /* 200 baud */ | 106 | #define RIO_B200 0x06 /* 200 baud */ |
107 | #define RIO_B300 0x07 /* 300 baud */ | 107 | #define RIO_B300 0x07 /* 300 baud */ |
108 | #define RIO_B600 0x08 /* 600 baud */ | 108 | #define RIO_B600 0x08 /* 600 baud */ |
109 | #define RIO_B1200 0x09 /* 1200 baud */ | 109 | #define RIO_B1200 0x09 /* 1200 baud */ |
110 | #define RIO_B1800 0x0A /* 1800 baud */ | 110 | #define RIO_B1800 0x0A /* 1800 baud */ |
111 | #define RIO_B2400 0x0B /* 2400 baud */ | 111 | #define RIO_B2400 0x0B /* 2400 baud */ |
112 | #define RIO_B4800 0x0C /* 4800 baud */ | 112 | #define RIO_B4800 0x0C /* 4800 baud */ |
113 | #define RIO_B9600 0x0D /* 9600 baud */ | 113 | #define RIO_B9600 0x0D /* 9600 baud */ |
114 | #define RIO_B19200 0x0E /* 19200 baud */ | 114 | #define RIO_B19200 0x0E /* 19200 baud */ |
115 | #define RIO_B38400 0x0F /* 38400 baud */ | 115 | #define RIO_B38400 0x0F /* 38400 baud */ |
116 | #define RIO_B56000 0x10 /* 56000 baud */ | 116 | #define RIO_B56000 0x10 /* 56000 baud */ |
117 | #define RIO_B57600 0x11 /* 57600 baud */ | 117 | #define RIO_B57600 0x11 /* 57600 baud */ |
118 | #define RIO_B64000 0x12 /* 64000 baud */ | 118 | #define RIO_B64000 0x12 /* 64000 baud */ |
119 | #define RIO_B115200 0x13 /* 115200 baud */ | 119 | #define RIO_B115200 0x13 /* 115200 baud */ |
120 | #define RIO_B2000 0x14 /* 2000 baud */ | 120 | #define RIO_B2000 0x14 /* 2000 baud */ |
121 | |||
122 | |||
diff --git a/drivers/char/rio/list.h b/drivers/char/rio/list.h index a4f7f1f56255..36aad4c9cb3a 100644 --- a/drivers/char/rio/list.h +++ b/drivers/char/rio/list.h | |||
@@ -38,7 +38,7 @@ | |||
38 | 38 | ||
39 | #ifdef SCCS_LABELS | 39 | #ifdef SCCS_LABELS |
40 | #ifndef lint | 40 | #ifndef lint |
41 | static char *_rio_list_h_sccs = "@(#)list.h 1.9" ; | 41 | static char *_rio_list_h_sccs = "@(#)list.h 1.9"; |
42 | #endif | 42 | #endif |
43 | #endif | 43 | #endif |
44 | 44 | ||
@@ -166,7 +166,7 @@ static char *_rio_list_h_sccs = "@(#)list.h 1.9" ; | |||
166 | #endif | 166 | #endif |
167 | 167 | ||
168 | 168 | ||
169 | #else /* !IN_KERNEL */ | 169 | #else /* !IN_KERNEL */ |
170 | 170 | ||
171 | #define ZERO_PTR NULL | 171 | #define ZERO_PTR NULL |
172 | 172 | ||
@@ -192,5 +192,5 @@ static char *_rio_list_h_sccs = "@(#)list.h 1.9" ; | |||
192 | #define splx(oldspl) if ((oldspl) == 0) spl0() | 192 | #define splx(oldspl) if ((oldspl) == 0) spl0() |
193 | #endif | 193 | #endif |
194 | 194 | ||
195 | #endif /* ifndef _list.h */ | 195 | #endif /* ifndef _list.h */ |
196 | /*********** end of file ***********/ | 196 | /*********** end of file ***********/ |
diff --git a/drivers/char/rio/lrt.h b/drivers/char/rio/lrt.h index bbac8fa18fee..b41764d7a22a 100644 --- a/drivers/char/rio/lrt.h +++ b/drivers/char/rio/lrt.h | |||
@@ -36,7 +36,7 @@ | |||
36 | 36 | ||
37 | #ifndef lint | 37 | #ifndef lint |
38 | #ifdef SCCS_LABELS | 38 | #ifdef SCCS_LABELS |
39 | static char *_rio_lrt_h_sccs = "@(#)lrt.h 1.1" ; | 39 | static char *_rio_lrt_h_sccs = "@(#)lrt.h 1.1"; |
40 | #endif | 40 | #endif |
41 | #endif | 41 | #endif |
42 | 42 | ||
@@ -50,6 +50,3 @@ static char *_rio_lrt_h_sccs = "@(#)lrt.h 1.1" ; | |||
50 | 50 | ||
51 | 51 | ||
52 | /*********** end of file ***********/ | 52 | /*********** end of file ***********/ |
53 | |||
54 | |||
55 | |||
diff --git a/drivers/char/rio/ltt.h b/drivers/char/rio/ltt.h index f27dcecf03ca..ab04004d4048 100644 --- a/drivers/char/rio/ltt.h +++ b/drivers/char/rio/ltt.h | |||
@@ -36,7 +36,7 @@ | |||
36 | 36 | ||
37 | #ifndef lint | 37 | #ifndef lint |
38 | #ifdef SCCS_LABELS | 38 | #ifdef SCCS_LABELS |
39 | static char *_rio_ltt_h_sccs = "@(#)ltt.h 1.1" ; | 39 | static char *_rio_ltt_h_sccs = "@(#)ltt.h 1.1"; |
40 | #endif | 40 | #endif |
41 | #endif | 41 | #endif |
42 | 42 | ||
@@ -45,11 +45,8 @@ static char *_rio_ltt_h_sccs = "@(#)ltt.h 1.1" ; | |||
45 | #else | 45 | #else |
46 | #define LTT_STACK (ushort) 200 | 46 | #define LTT_STACK (ushort) 200 |
47 | #endif | 47 | #endif |
48 | |||
49 | 48 | ||
50 | 49 | ||
51 | 50 | ||
52 | /*********** end of file ***********/ | ||
53 | |||
54 | |||
55 | 51 | ||
52 | /*********** end of file ***********/ | ||
diff --git a/drivers/char/rio/lttwake.h b/drivers/char/rio/lttwake.h index fe17d0ee4933..fdf0c1f250ab 100644 --- a/drivers/char/rio/lttwake.h +++ b/drivers/char/rio/lttwake.h | |||
@@ -39,7 +39,7 @@ | |||
39 | 39 | ||
40 | #ifndef lint | 40 | #ifndef lint |
41 | #ifdef SCCS_LABELS | 41 | #ifdef SCCS_LABELS |
42 | static char *_rio_lttwake_h_sccs = "@(#)lttwake.h 1.1" ; | 42 | static char *_rio_lttwake_h_sccs = "@(#)lttwake.h 1.1"; |
43 | #endif | 43 | #endif |
44 | #endif | 44 | #endif |
45 | 45 | ||
@@ -48,6 +48,3 @@ static char *_rio_lttwake_h_sccs = "@(#)lttwake.h 1.1" ; | |||
48 | 48 | ||
49 | 49 | ||
50 | /*********** end of file ***********/ | 50 | /*********** end of file ***********/ |
51 | |||
52 | |||
53 | |||
diff --git a/drivers/char/rio/map.h b/drivers/char/rio/map.h index 400645a1ff28..97fe287aab2a 100644 --- a/drivers/char/rio/map.h +++ b/drivers/char/rio/map.h | |||
@@ -46,21 +46,20 @@ static char *_map_h_sccs_ = "@(#)map.h 1.2"; | |||
46 | #define TOTAL_MAP_ENTRIES (MAX_MAP_ENTRY*RIO_SLOTS) | 46 | #define TOTAL_MAP_ENTRIES (MAX_MAP_ENTRY*RIO_SLOTS) |
47 | #define MAX_NAME_LEN 32 | 47 | #define MAX_NAME_LEN 32 |
48 | 48 | ||
49 | struct Map | 49 | struct Map { |
50 | { | 50 | uint HostUniqueNum; /* Supporting hosts unique number */ |
51 | uint HostUniqueNum; /* Supporting hosts unique number */ | 51 | uint RtaUniqueNum; /* Unique number */ |
52 | uint RtaUniqueNum; /* Unique number */ | ||
53 | /* | 52 | /* |
54 | ** The next two IDs must be swapped on big-endian architectures | 53 | ** The next two IDs must be swapped on big-endian architectures |
55 | ** when using a v2.04 /etc/rio/config with a v3.00 driver (when | 54 | ** when using a v2.04 /etc/rio/config with a v3.00 driver (when |
56 | ** upgrading for example). | 55 | ** upgrading for example). |
57 | */ | 56 | */ |
58 | ushort ID; /* ID used in the subnet */ | 57 | ushort ID; /* ID used in the subnet */ |
59 | ushort ID2; /* ID of 2nd block of 8 for 16 port */ | 58 | ushort ID2; /* ID of 2nd block of 8 for 16 port */ |
60 | ulong Flags; /* Booted, ID Given, Disconnected */ | 59 | ulong Flags; /* Booted, ID Given, Disconnected */ |
61 | ulong SysPort; /* First tty mapped to this port */ | 60 | ulong SysPort; /* First tty mapped to this port */ |
62 | struct Top Topology[LINKS_PER_UNIT]; /* ID connected to each link */ | 61 | struct Top Topology[LINKS_PER_UNIT]; /* ID connected to each link */ |
63 | char Name[MAX_NAME_LEN]; /* Cute name by which RTA is known */ | 62 | char Name[MAX_NAME_LEN]; /* Cute name by which RTA is known */ |
64 | }; | 63 | }; |
65 | 64 | ||
66 | /* | 65 | /* |
diff --git a/drivers/char/rio/mca.h b/drivers/char/rio/mca.h index 08a327e473af..d01e76be7a17 100644 --- a/drivers/char/rio/mca.h +++ b/drivers/char/rio/mca.h | |||
@@ -70,4 +70,4 @@ static char *_mca_h_sccs_ = "@(#)mca.h 1.2"; | |||
70 | 70 | ||
71 | #define RIO_MCA_DEFAULT_MODE SLOW_LINKS | 71 | #define RIO_MCA_DEFAULT_MODE SLOW_LINKS |
72 | 72 | ||
73 | #endif /* __rio_mca_h__ */ | 73 | #endif /* __rio_mca_h__ */ |
diff --git a/drivers/char/rio/mesg.h b/drivers/char/rio/mesg.h index 9cf6c0bacea4..dd9be586ec6f 100644 --- a/drivers/char/rio/mesg.h +++ b/drivers/char/rio/mesg.h | |||
@@ -38,4 +38,4 @@ static char *_mesg_h_sccs_ = "@(#)mesg.h 1.2"; | |||
38 | #endif | 38 | #endif |
39 | 39 | ||
40 | 40 | ||
41 | #endif /* __rio_mesg_h__ */ | 41 | #endif /* __rio_mesg_h__ */ |
diff --git a/drivers/char/rio/param.h b/drivers/char/rio/param.h index 2dc30b9aab37..de7e57180c91 100644 --- a/drivers/char/rio/param.h +++ b/drivers/char/rio/param.h | |||
@@ -42,20 +42,19 @@ static char *_param_h_sccs_ = "@(#)param.h 1.2"; | |||
42 | ** the param command block, as used in OPEN and PARAM calls. | 42 | ** the param command block, as used in OPEN and PARAM calls. |
43 | */ | 43 | */ |
44 | 44 | ||
45 | struct phb_param | 45 | struct phb_param { |
46 | { | 46 | BYTE Cmd; /* It is very important that these line up */ |
47 | BYTE Cmd; /* It is very important that these line up */ | 47 | BYTE Cor1; /* with what is expected at the other end. */ |
48 | BYTE Cor1; /* with what is expected at the other end. */ | 48 | BYTE Cor2; /* to confirm that you've got it right, */ |
49 | BYTE Cor2; /* to confirm that you've got it right, */ | 49 | BYTE Cor4; /* check with cirrus/cirrus.h */ |
50 | BYTE Cor4; /* check with cirrus/cirrus.h */ | 50 | BYTE Cor5; |
51 | BYTE Cor5; | 51 | BYTE TxXon; /* Transmit X-On character */ |
52 | BYTE TxXon; /* Transmit X-On character */ | 52 | BYTE TxXoff; /* Transmit X-Off character */ |
53 | BYTE TxXoff; /* Transmit X-Off character */ | 53 | BYTE RxXon; /* Receive X-On character */ |
54 | BYTE RxXon; /* Receive X-On character */ | 54 | BYTE RxXoff; /* Receive X-Off character */ |
55 | BYTE RxXoff; /* Receive X-Off character */ | 55 | BYTE LNext; /* Literal-next character */ |
56 | BYTE LNext; /* Literal-next character */ | 56 | BYTE TxBaud; /* Transmit baudrate */ |
57 | BYTE TxBaud; /* Transmit baudrate */ | 57 | BYTE RxBaud; /* Receive baudrate */ |
58 | BYTE RxBaud; /* Receive baudrate */ | ||
59 | }; | 58 | }; |
60 | 59 | ||
61 | #endif | 60 | #endif |
diff --git a/drivers/char/rio/parmmap.h b/drivers/char/rio/parmmap.h index 46f99dfdac8d..fe4e00567065 100644 --- a/drivers/char/rio/parmmap.h +++ b/drivers/char/rio/parmmap.h | |||
@@ -44,53 +44,50 @@ | |||
44 | #endif | 44 | #endif |
45 | #endif | 45 | #endif |
46 | 46 | ||
47 | typedef struct PARM_MAP PARM_MAP ; | 47 | typedef struct PARM_MAP PARM_MAP; |
48 | 48 | ||
49 | struct PARM_MAP | 49 | struct PARM_MAP { |
50 | { | 50 | PHB_ptr phb_ptr; /* Pointer to the PHB array */ |
51 | PHB_ptr phb_ptr ; /* Pointer to the PHB array */ | 51 | WORD_ptr phb_num_ptr; /* Ptr to Number of PHB's */ |
52 | WORD_ptr phb_num_ptr ; /* Ptr to Number of PHB's */ | 52 | FREE_LIST_ptr free_list; /* Free List pointer */ |
53 | FREE_LIST_ptr free_list; /* Free List pointer */ | 53 | FREE_LIST_ptr free_list_end; /* Free List End pointer */ |
54 | FREE_LIST_ptr free_list_end; /* Free List End pointer */ | 54 | Q_BUF_ptr_ptr q_free_list_ptr; /* Ptr to Q_BUF variable */ |
55 | Q_BUF_ptr_ptr q_free_list_ptr ; /* Ptr to Q_BUF variable */ | 55 | BYTE_ptr unit_id_ptr; /* Unit Id */ |
56 | BYTE_ptr unit_id_ptr ; /* Unit Id */ | 56 | LPB_ptr link_str_ptr; /* Link Structure Array */ |
57 | LPB_ptr link_str_ptr ; /* Link Structure Array */ | 57 | BYTE_ptr bootloader_1; /* 1st Stage Boot Loader */ |
58 | BYTE_ptr bootloader_1 ; /* 1st Stage Boot Loader */ | 58 | BYTE_ptr bootloader_2; /* 2nd Stage Boot Loader */ |
59 | BYTE_ptr bootloader_2 ; /* 2nd Stage Boot Loader */ | 59 | WORD_ptr port_route_map_ptr; /* Port Route Map */ |
60 | WORD_ptr port_route_map_ptr ; /* Port Route Map */ | 60 | ROUTE_STR_ptr route_ptr; /* Unit Route Map */ |
61 | ROUTE_STR_ptr route_ptr ; /* Unit Route Map */ | 61 | NUMBER_ptr map_present; /* Route Map present */ |
62 | NUMBER_ptr map_present ; /* Route Map present */ | 62 | NUMBER pkt_num; /* Total number of packets */ |
63 | NUMBER pkt_num ; /* Total number of packets */ | 63 | NUMBER q_num; /* Total number of Q packets */ |
64 | NUMBER q_num ; /* Total number of Q packets */ | 64 | WORD buffers_per_port; /* Number of buffers per port */ |
65 | WORD buffers_per_port ; /* Number of buffers per port */ | 65 | WORD heap_size; /* Initial size of heap */ |
66 | WORD heap_size ; /* Initial size of heap */ | 66 | WORD heap_left; /* Current Heap left */ |
67 | WORD heap_left ; /* Current Heap left */ | 67 | WORD error; /* Error code */ |
68 | WORD error ; /* Error code */ | 68 | WORD tx_max; /* Max number of tx pkts per phb */ |
69 | WORD tx_max; /* Max number of tx pkts per phb */ | 69 | WORD rx_max; /* Max number of rx pkts per phb */ |
70 | WORD rx_max; /* Max number of rx pkts per phb */ | 70 | WORD rx_limit; /* For high / low watermarks */ |
71 | WORD rx_limit; /* For high / low watermarks */ | 71 | NUMBER links; /* Links to use */ |
72 | NUMBER links ; /* Links to use */ | 72 | NUMBER timer; /* Interrupts per second */ |
73 | NUMBER timer ; /* Interrupts per second */ | 73 | RUP_ptr rups; /* Pointer to the RUPs */ |
74 | RUP_ptr rups ; /* Pointer to the RUPs */ | 74 | WORD max_phb; /* Mostly for debugging */ |
75 | WORD max_phb ; /* Mostly for debugging */ | 75 | WORD living; /* Just increments!! */ |
76 | WORD living ; /* Just increments!! */ | 76 | WORD init_done; /* Initialisation over */ |
77 | WORD init_done ; /* Initialisation over */ | 77 | WORD booting_link; |
78 | WORD booting_link ; | 78 | WORD idle_count; /* Idle time counter */ |
79 | WORD idle_count ; /* Idle time counter */ | 79 | WORD busy_count; /* Busy counter */ |
80 | WORD busy_count ; /* Busy counter */ | 80 | WORD idle_control; /* Control Idle Process */ |
81 | WORD idle_control ; /* Control Idle Process */ | ||
82 | #if defined(HOST) || defined(INKERNEL) | 81 | #if defined(HOST) || defined(INKERNEL) |
83 | WORD tx_intr; /* TX interrupt pending */ | 82 | WORD tx_intr; /* TX interrupt pending */ |
84 | WORD rx_intr; /* RX interrupt pending */ | 83 | WORD rx_intr; /* RX interrupt pending */ |
85 | WORD rup_intr; /* RUP interrupt pending */ | 84 | WORD rup_intr; /* RUP interrupt pending */ |
86 | #endif | 85 | #endif |
87 | #if defined(RTA) | 86 | #if defined(RTA) |
88 | WORD dying_count; /* Count of processes dead */ | 87 | WORD dying_count; /* Count of processes dead */ |
89 | #endif | 88 | #endif |
90 | } ; | 89 | }; |
91 | 90 | ||
92 | #endif | 91 | #endif |
93 | 92 | ||
94 | /*********** end of file ***********/ | 93 | /*********** end of file ***********/ |
95 | |||
96 | |||
diff --git a/drivers/char/rio/pci.h b/drivers/char/rio/pci.h index dc635bd25194..1eba9118079b 100644 --- a/drivers/char/rio/pci.h +++ b/drivers/char/rio/pci.h | |||
@@ -73,4 +73,4 @@ static char *_pci_h_sccs_ = "@(#)pci.h 1.2"; | |||
73 | 73 | ||
74 | #define RIO_PCI_DEFAULT_MODE 0x05 | 74 | #define RIO_PCI_DEFAULT_MODE 0x05 |
75 | 75 | ||
76 | #endif /* __rio_pci_h__ */ | 76 | #endif /* __rio_pci_h__ */ |
diff --git a/drivers/char/rio/phb.h b/drivers/char/rio/phb.h index e1483a0e30bd..3baebf8513af 100644 --- a/drivers/char/rio/phb.h +++ b/drivers/char/rio/phb.h | |||
@@ -58,37 +58,37 @@ | |||
58 | /************************************************* | 58 | /************************************************* |
59 | * Handshake asserted. Deasserted by the LTT(s) | 59 | * Handshake asserted. Deasserted by the LTT(s) |
60 | ************************************************/ | 60 | ************************************************/ |
61 | #define PHB_HANDSHAKE_SET ((ushort) 0x001) /* Set by LRT */ | 61 | #define PHB_HANDSHAKE_SET ((ushort) 0x001) /* Set by LRT */ |
62 | 62 | ||
63 | #define PHB_HANDSHAKE_RESET ((ushort) 0x002) /* Set by ISR / driver */ | 63 | #define PHB_HANDSHAKE_RESET ((ushort) 0x002) /* Set by ISR / driver */ |
64 | 64 | ||
65 | #define PHB_HANDSHAKE_FLAGS (PHB_HANDSHAKE_RESET | PHB_HANDSHAKE_SET) | 65 | #define PHB_HANDSHAKE_FLAGS (PHB_HANDSHAKE_RESET | PHB_HANDSHAKE_SET) |
66 | /* Reset by ltt */ | 66 | /* Reset by ltt */ |
67 | 67 | ||
68 | 68 | ||
69 | /************************************************* | 69 | /************************************************* |
70 | * Maximum number of PHB's | 70 | * Maximum number of PHB's |
71 | ************************************************/ | 71 | ************************************************/ |
72 | #if defined (HOST) || defined (INKERNEL) | 72 | #if defined (HOST) || defined (INKERNEL) |
73 | #define MAX_PHB ((ushort) 128) /* range 0-127 */ | 73 | #define MAX_PHB ((ushort) 128) /* range 0-127 */ |
74 | #else | 74 | #else |
75 | #define MAX_PHB ((ushort) 8) /* range 0-7 */ | 75 | #define MAX_PHB ((ushort) 8) /* range 0-7 */ |
76 | #endif | 76 | #endif |
77 | 77 | ||
78 | /************************************************* | 78 | /************************************************* |
79 | * Defines for the mode fields | 79 | * Defines for the mode fields |
80 | ************************************************/ | 80 | ************************************************/ |
81 | #define TXPKT_INCOMPLETE 0x0001 /* Previous tx packet not completed */ | 81 | #define TXPKT_INCOMPLETE 0x0001 /* Previous tx packet not completed */ |
82 | #define TXINTR_ENABLED 0x0002 /* Tx interrupt is enabled */ | 82 | #define TXINTR_ENABLED 0x0002 /* Tx interrupt is enabled */ |
83 | #define TX_TAB3 0x0004 /* TAB3 mode */ | 83 | #define TX_TAB3 0x0004 /* TAB3 mode */ |
84 | #define TX_OCRNL 0x0008 /* OCRNL mode */ | 84 | #define TX_OCRNL 0x0008 /* OCRNL mode */ |
85 | #define TX_ONLCR 0x0010 /* ONLCR mode */ | 85 | #define TX_ONLCR 0x0010 /* ONLCR mode */ |
86 | #define TX_SENDSPACES 0x0020 /* Send n spaces command needs | 86 | #define TX_SENDSPACES 0x0020 /* Send n spaces command needs |
87 | completing */ | 87 | completing */ |
88 | #define TX_SENDNULL 0x0040 /* Escaping NULL needs completing */ | 88 | #define TX_SENDNULL 0x0040 /* Escaping NULL needs completing */ |
89 | #define TX_SENDLF 0x0080 /* LF -> CR LF needs completing */ | 89 | #define TX_SENDLF 0x0080 /* LF -> CR LF needs completing */ |
90 | #define TX_PARALLELBUG 0x0100 /* CD1400 LF -> CR LF bug on parallel | 90 | #define TX_PARALLELBUG 0x0100 /* CD1400 LF -> CR LF bug on parallel |
91 | port */ | 91 | port */ |
92 | #define TX_HANGOVER (TX_SENDSPACES | TX_SENDLF | TX_SENDNULL) | 92 | #define TX_HANGOVER (TX_SENDSPACES | TX_SENDLF | TX_SENDNULL) |
93 | #define TX_DTRFLOW 0x0200 /* DTR tx flow control */ | 93 | #define TX_DTRFLOW 0x0200 /* DTR tx flow control */ |
94 | #define TX_DTRFLOWED 0x0400 /* DTR is low - don't allow more data | 94 | #define TX_DTRFLOWED 0x0400 /* DTR is low - don't allow more data |
@@ -96,34 +96,34 @@ | |||
96 | #define TX_DATAINFIFO 0x0800 /* There is data in the FIFO */ | 96 | #define TX_DATAINFIFO 0x0800 /* There is data in the FIFO */ |
97 | #define TX_BUSY 0x1000 /* Data in FIFO, shift or holding regs */ | 97 | #define TX_BUSY 0x1000 /* Data in FIFO, shift or holding regs */ |
98 | 98 | ||
99 | #define RX_SPARE 0x0001 /* SPARE */ | 99 | #define RX_SPARE 0x0001 /* SPARE */ |
100 | #define RXINTR_ENABLED 0x0002 /* Rx interrupt enabled */ | 100 | #define RXINTR_ENABLED 0x0002 /* Rx interrupt enabled */ |
101 | #define RX_ICRNL 0x0008 /* ICRNL mode */ | 101 | #define RX_ICRNL 0x0008 /* ICRNL mode */ |
102 | #define RX_INLCR 0x0010 /* INLCR mode */ | 102 | #define RX_INLCR 0x0010 /* INLCR mode */ |
103 | #define RX_IGNCR 0x0020 /* IGNCR mode */ | 103 | #define RX_IGNCR 0x0020 /* IGNCR mode */ |
104 | #define RX_CTSFLOW 0x0040 /* CTSFLOW enabled */ | 104 | #define RX_CTSFLOW 0x0040 /* CTSFLOW enabled */ |
105 | #define RX_IXOFF 0x0080 /* IXOFF enabled */ | 105 | #define RX_IXOFF 0x0080 /* IXOFF enabled */ |
106 | #define RX_CTSFLOWED 0x0100 /* CTSFLOW and CTS dropped */ | 106 | #define RX_CTSFLOWED 0x0100 /* CTSFLOW and CTS dropped */ |
107 | #define RX_IXOFFED 0x0200 /* IXOFF and xoff sent */ | 107 | #define RX_IXOFFED 0x0200 /* IXOFF and xoff sent */ |
108 | #define RX_BUFFERED 0x0400 /* Try and pass on complete packets */ | 108 | #define RX_BUFFERED 0x0400 /* Try and pass on complete packets */ |
109 | 109 | ||
110 | #define PORT_ISOPEN 0x0001 /* Port open? */ | 110 | #define PORT_ISOPEN 0x0001 /* Port open? */ |
111 | #define PORT_HUPCL 0x0002 /* Hangup on close? */ | 111 | #define PORT_HUPCL 0x0002 /* Hangup on close? */ |
112 | #define PORT_MOPENPEND 0x0004 /* Modem open pending */ | 112 | #define PORT_MOPENPEND 0x0004 /* Modem open pending */ |
113 | #define PORT_ISPARALLEL 0x0008 /* Parallel port */ | 113 | #define PORT_ISPARALLEL 0x0008 /* Parallel port */ |
114 | #define PORT_BREAK 0x0010 /* Port on break */ | 114 | #define PORT_BREAK 0x0010 /* Port on break */ |
115 | #define PORT_STATUSPEND 0x0020 /* Status packet pending */ | 115 | #define PORT_STATUSPEND 0x0020 /* Status packet pending */ |
116 | #define PORT_BREAKPEND 0x0040 /* Break packet pending */ | 116 | #define PORT_BREAKPEND 0x0040 /* Break packet pending */ |
117 | #define PORT_MODEMPEND 0x0080 /* Modem status packet pending */ | 117 | #define PORT_MODEMPEND 0x0080 /* Modem status packet pending */ |
118 | #define PORT_PARALLELBUG 0x0100 /* CD1400 LF -> CR LF bug on parallel | 118 | #define PORT_PARALLELBUG 0x0100 /* CD1400 LF -> CR LF bug on parallel |
119 | port */ | 119 | port */ |
120 | #define PORT_FULLMODEM 0x0200 /* Full modem signals */ | 120 | #define PORT_FULLMODEM 0x0200 /* Full modem signals */ |
121 | #define PORT_RJ45 0x0400 /* RJ45 connector - no RI signal */ | 121 | #define PORT_RJ45 0x0400 /* RJ45 connector - no RI signal */ |
122 | #define PORT_RESTRICTED 0x0600 /* Restricted connector - no RI / DTR */ | 122 | #define PORT_RESTRICTED 0x0600 /* Restricted connector - no RI / DTR */ |
123 | 123 | ||
124 | #define PORT_MODEMBITS 0x0600 /* Mask for modem fields */ | 124 | #define PORT_MODEMBITS 0x0600 /* Mask for modem fields */ |
125 | 125 | ||
126 | #define PORT_WCLOSE 0x0800 /* Waiting for close */ | 126 | #define PORT_WCLOSE 0x0800 /* Waiting for close */ |
127 | #define PORT_HANDSHAKEFIX 0x1000 /* Port has H/W flow control fix */ | 127 | #define PORT_HANDSHAKEFIX 0x1000 /* Port has H/W flow control fix */ |
128 | #define PORT_WASPCLOSED 0x2000 /* Port closed with PCLOSE */ | 128 | #define PORT_WASPCLOSED 0x2000 /* Port closed with PCLOSE */ |
129 | #define DUMPMODE 0x4000 /* Dump RTA mem */ | 129 | #define DUMPMODE 0x4000 /* Dump RTA mem */ |
@@ -155,139 +155,128 @@ | |||
155 | #define rx_end u4.s1.rx_end_ptr_ptr | 155 | #define rx_end u4.s1.rx_end_ptr_ptr |
156 | #define rx_remove u4.s1.rx_remove_ptr_ptr | 156 | #define rx_remove u4.s1.rx_remove_ptr_ptr |
157 | #endif | 157 | #endif |
158 | typedef struct PHB PHB ; | 158 | typedef struct PHB PHB; |
159 | struct PHB { | 159 | struct PHB { |
160 | #ifdef RTA | 160 | #ifdef RTA |
161 | ushort port; | 161 | ushort port; |
162 | #endif | 162 | #endif |
163 | #ifdef INKERNEL | 163 | #ifdef INKERNEL |
164 | WORD source; | 164 | WORD source; |
165 | #else | 165 | #else |
166 | union | 166 | union { |
167 | { | 167 | ushort source; /* Complete source */ |
168 | ushort source; /* Complete source */ | 168 | struct { |
169 | struct | 169 | unsigned char unit; /* Source unit */ |
170 | { | 170 | unsigned char port; /* Source port */ |
171 | unsigned char unit; /* Source unit */ | 171 | } s2; |
172 | unsigned char port; /* Source port */ | 172 | } u2; |
173 | } s2; | ||
174 | } u2; | ||
175 | #endif | 173 | #endif |
176 | WORD handshake ; | 174 | WORD handshake; |
177 | WORD status ; | 175 | WORD status; |
178 | NUMBER timeout ; /* Maximum of 1.9 seconds */ | 176 | NUMBER timeout; /* Maximum of 1.9 seconds */ |
179 | WORD link ; /* Send down this link */ | 177 | WORD link; /* Send down this link */ |
180 | #ifdef INKERNEL | 178 | #ifdef INKERNEL |
181 | WORD destination; | 179 | WORD destination; |
182 | #else | 180 | #else |
183 | union | 181 | union { |
184 | { | 182 | ushort destination; /* Complete destination */ |
185 | ushort destination; /* Complete destination */ | 183 | struct { |
186 | struct | 184 | unsigned char unit; /* Destination unit */ |
187 | { | 185 | unsigned char port; /* Destination port */ |
188 | unsigned char unit; /* Destination unit */ | 186 | } s1; |
189 | unsigned char port; /* Destination port */ | 187 | } u1; |
190 | } s1; | ||
191 | } u1; | ||
192 | #endif | 188 | #endif |
193 | #ifdef RTA | 189 | #ifdef RTA |
194 | ushort tx_pkts_added; | 190 | ushort tx_pkts_added; |
195 | ushort tx_pkts_removed; | 191 | ushort tx_pkts_removed; |
196 | Q_BUF_ptr tx_q_start ; /* Start of the Q list chain */ | 192 | Q_BUF_ptr tx_q_start; /* Start of the Q list chain */ |
197 | short num_tx_q_bufs ; /* Number of Q buffers in the chain */ | 193 | short num_tx_q_bufs; /* Number of Q buffers in the chain */ |
198 | PKT_ptr_ptr tx_add ; /* Add a new Packet here */ | 194 | PKT_ptr_ptr tx_add; /* Add a new Packet here */ |
199 | Q_BUF_ptr tx_add_qb; /* Pointer to the add Q buf */ | 195 | Q_BUF_ptr tx_add_qb; /* Pointer to the add Q buf */ |
200 | PKT_ptr_ptr tx_add_st_qbb ; /* Pointer to start of the Q's buf */ | 196 | PKT_ptr_ptr tx_add_st_qbb; /* Pointer to start of the Q's buf */ |
201 | PKT_ptr_ptr tx_add_end_qbb ; /* Pointer to the end of the Q's buf */ | 197 | PKT_ptr_ptr tx_add_end_qbb; /* Pointer to the end of the Q's buf */ |
202 | PKT_ptr_ptr tx_remove ; /* Remove a Packet here */ | 198 | PKT_ptr_ptr tx_remove; /* Remove a Packet here */ |
203 | Q_BUF_ptr tx_remove_qb ; /* Pointer to the remove Q buf */ | 199 | Q_BUF_ptr tx_remove_qb; /* Pointer to the remove Q buf */ |
204 | PKT_ptr_ptr tx_remove_st_qbb ; /* Pointer to the start of the Q buf */ | 200 | PKT_ptr_ptr tx_remove_st_qbb; /* Pointer to the start of the Q buf */ |
205 | PKT_ptr_ptr tx_remove_end_qbb ; /* Pointer to the end of the Q buf */ | 201 | PKT_ptr_ptr tx_remove_end_qbb; /* Pointer to the end of the Q buf */ |
206 | #endif | 202 | #endif |
207 | #ifdef INKERNEL | 203 | #ifdef INKERNEL |
208 | PKT_ptr_ptr tx_start ; | 204 | PKT_ptr_ptr tx_start; |
209 | PKT_ptr_ptr tx_end ; | 205 | PKT_ptr_ptr tx_end; |
210 | PKT_ptr_ptr tx_add ; | 206 | PKT_ptr_ptr tx_add; |
211 | PKT_ptr_ptr tx_remove ; | 207 | PKT_ptr_ptr tx_remove; |
212 | #endif | 208 | #endif |
213 | #ifdef HOST | 209 | #ifdef HOST |
214 | union | 210 | union { |
215 | { | 211 | struct { |
216 | struct | 212 | PKT_ptr_ptr tx_start_ptr_ptr; |
217 | { | 213 | PKT_ptr_ptr tx_end_ptr_ptr; |
218 | PKT_ptr_ptr tx_start_ptr_ptr; | 214 | PKT_ptr_ptr tx_add_ptr_ptr; |
219 | PKT_ptr_ptr tx_end_ptr_ptr; | 215 | PKT_ptr_ptr tx_remove_ptr_ptr; |
220 | PKT_ptr_ptr tx_add_ptr_ptr; | 216 | } s1; |
221 | PKT_ptr_ptr tx_remove_ptr_ptr; | 217 | struct { |
222 | } s1; | 218 | ushort *tx_start_ptr; |
223 | struct | 219 | ushort *tx_end_ptr; |
224 | { | 220 | ushort *tx_add_ptr; |
225 | ushort * tx_start_ptr; | 221 | ushort *tx_remove_ptr; |
226 | ushort * tx_end_ptr; | 222 | } s2; |
227 | ushort * tx_add_ptr; | 223 | } u3; |
228 | ushort * tx_remove_ptr; | ||
229 | } s2; | ||
230 | } u3; | ||
231 | #endif | 224 | #endif |
232 | 225 | ||
233 | #ifdef RTA | 226 | #ifdef RTA |
234 | ushort rx_pkts_added; | 227 | ushort rx_pkts_added; |
235 | ushort rx_pkts_removed; | 228 | ushort rx_pkts_removed; |
236 | Q_BUF_ptr rx_q_start ; /* Start of the Q list chain */ | 229 | Q_BUF_ptr rx_q_start; /* Start of the Q list chain */ |
237 | short num_rx_q_bufs ; /* Number of Q buffers in the chain */ | 230 | short num_rx_q_bufs; /* Number of Q buffers in the chain */ |
238 | PKT_ptr_ptr rx_add ; /* Add a new Packet here */ | 231 | PKT_ptr_ptr rx_add; /* Add a new Packet here */ |
239 | Q_BUF_ptr rx_add_qb ; /* Pointer to the add Q buf */ | 232 | Q_BUF_ptr rx_add_qb; /* Pointer to the add Q buf */ |
240 | PKT_ptr_ptr rx_add_st_qbb ; /* Pointer to start of the Q's buf */ | 233 | PKT_ptr_ptr rx_add_st_qbb; /* Pointer to start of the Q's buf */ |
241 | PKT_ptr_ptr rx_add_end_qbb ; /* Pointer to the end of the Q's buf */ | 234 | PKT_ptr_ptr rx_add_end_qbb; /* Pointer to the end of the Q's buf */ |
242 | PKT_ptr_ptr rx_remove ; /* Remove a Packet here */ | 235 | PKT_ptr_ptr rx_remove; /* Remove a Packet here */ |
243 | Q_BUF_ptr rx_remove_qb ; /* Pointer to the remove Q buf */ | 236 | Q_BUF_ptr rx_remove_qb; /* Pointer to the remove Q buf */ |
244 | PKT_ptr_ptr rx_remove_st_qbb ; /* Pointer to the start of the Q buf */ | 237 | PKT_ptr_ptr rx_remove_st_qbb; /* Pointer to the start of the Q buf */ |
245 | PKT_ptr_ptr rx_remove_end_qbb ; /* Pointer to the end of the Q buf */ | 238 | PKT_ptr_ptr rx_remove_end_qbb; /* Pointer to the end of the Q buf */ |
246 | #endif | 239 | #endif |
247 | #ifdef INKERNEL | 240 | #ifdef INKERNEL |
248 | PKT_ptr_ptr rx_start ; | 241 | PKT_ptr_ptr rx_start; |
249 | PKT_ptr_ptr rx_end ; | 242 | PKT_ptr_ptr rx_end; |
250 | PKT_ptr_ptr rx_add ; | 243 | PKT_ptr_ptr rx_add; |
251 | PKT_ptr_ptr rx_remove ; | 244 | PKT_ptr_ptr rx_remove; |
252 | #endif | 245 | #endif |
253 | #ifdef HOST | 246 | #ifdef HOST |
254 | union | 247 | union { |
255 | { | 248 | struct { |
256 | struct | 249 | PKT_ptr_ptr rx_start_ptr_ptr; |
257 | { | 250 | PKT_ptr_ptr rx_end_ptr_ptr; |
258 | PKT_ptr_ptr rx_start_ptr_ptr; | 251 | PKT_ptr_ptr rx_add_ptr_ptr; |
259 | PKT_ptr_ptr rx_end_ptr_ptr; | 252 | PKT_ptr_ptr rx_remove_ptr_ptr; |
260 | PKT_ptr_ptr rx_add_ptr_ptr; | 253 | } s1; |
261 | PKT_ptr_ptr rx_remove_ptr_ptr; | 254 | struct { |
262 | } s1; | 255 | ushort *rx_start_ptr; |
263 | struct | 256 | ushort *rx_end_ptr; |
264 | { | 257 | ushort *rx_add_ptr; |
265 | ushort * rx_start_ptr; | 258 | ushort *rx_remove_ptr; |
266 | ushort * rx_end_ptr; | 259 | } s2; |
267 | ushort * rx_add_ptr; | 260 | } u4; |
268 | ushort * rx_remove_ptr; | ||
269 | } s2; | ||
270 | } u4; | ||
271 | #endif | 261 | #endif |
272 | 262 | ||
273 | #ifdef RTA /* some fields for the remotes */ | 263 | #ifdef RTA /* some fields for the remotes */ |
274 | ushort flush_count; /* Count of write flushes */ | 264 | ushort flush_count; /* Count of write flushes */ |
275 | ushort txmode; /* Modes for tx */ | 265 | ushort txmode; /* Modes for tx */ |
276 | ushort rxmode; /* Modes for rx */ | 266 | ushort rxmode; /* Modes for rx */ |
277 | ushort portmode; /* Generic modes */ | 267 | ushort portmode; /* Generic modes */ |
278 | ushort column; /* TAB3 column count */ | 268 | ushort column; /* TAB3 column count */ |
279 | ushort tx_subscript; /* (TX) Subscript into data field */ | 269 | ushort tx_subscript; /* (TX) Subscript into data field */ |
280 | ushort rx_subscript; /* (RX) Subscript into data field */ | 270 | ushort rx_subscript; /* (RX) Subscript into data field */ |
281 | PKT_ptr rx_incomplete; /* Hold an incomplete packet here */ | 271 | PKT_ptr rx_incomplete; /* Hold an incomplete packet here */ |
282 | ushort modem_bits; /* Modem bits to mask */ | 272 | ushort modem_bits; /* Modem bits to mask */ |
283 | ushort lastModem; /* Modem control lines. */ | 273 | ushort lastModem; /* Modem control lines. */ |
284 | ushort addr; /* Address for sub commands */ | 274 | ushort addr; /* Address for sub commands */ |
285 | ushort MonitorTstate; /* TRUE if monitoring tstop */ | 275 | ushort MonitorTstate; /* TRUE if monitoring tstop */ |
286 | #endif | 276 | #endif |
287 | 277 | ||
288 | } ; | 278 | }; |
289 | 279 | ||
290 | #endif | 280 | #endif |
291 | 281 | ||
292 | /*********** end of file ***********/ | 282 | /*********** end of file ***********/ |
293 | |||
diff --git a/drivers/char/rio/pkt.h b/drivers/char/rio/pkt.h index 66bb2ff0f694..882fd429ac2e 100644 --- a/drivers/char/rio/pkt.h +++ b/drivers/char/rio/pkt.h | |||
@@ -69,52 +69,44 @@ | |||
69 | #define CONTROL_PKT_TTL_MASK (PKT_TTL_MASK << 8) | 69 | #define CONTROL_PKT_TTL_MASK (PKT_TTL_MASK << 8) |
70 | #define CONTROL_DATA_WNDW (DATA_WNDW << 8) | 70 | #define CONTROL_DATA_WNDW (DATA_WNDW << 8) |
71 | 71 | ||
72 | struct PKT { | 72 | struct PKT { |
73 | #ifdef INKERNEL | 73 | #ifdef INKERNEL |
74 | BYTE dest_unit ; /* Destination Unit Id */ | 74 | BYTE dest_unit; /* Destination Unit Id */ |
75 | BYTE dest_port ; /* Destination POrt */ | 75 | BYTE dest_port; /* Destination POrt */ |
76 | BYTE src_unit ; /* Source Unit Id */ | 76 | BYTE src_unit; /* Source Unit Id */ |
77 | BYTE src_port ; /* Source POrt */ | 77 | BYTE src_port; /* Source POrt */ |
78 | #else | 78 | #else |
79 | union | 79 | union { |
80 | { | 80 | ushort destination; /* Complete destination */ |
81 | ushort destination; /* Complete destination */ | 81 | struct { |
82 | struct | 82 | unsigned char unit; /* Destination unit */ |
83 | { | 83 | unsigned char port; /* Destination port */ |
84 | unsigned char unit; /* Destination unit */ | 84 | } s1; |
85 | unsigned char port; /* Destination port */ | 85 | } u1; |
86 | } s1; | 86 | union { |
87 | } u1; | 87 | ushort source; /* Complete source */ |
88 | union | 88 | struct { |
89 | { | 89 | unsigned char unit; /* Source unit */ |
90 | ushort source; /* Complete source */ | 90 | unsigned char port; /* Source port */ |
91 | struct | 91 | } s2; |
92 | { | 92 | } u2; |
93 | unsigned char unit; /* Source unit */ | ||
94 | unsigned char port; /* Source port */ | ||
95 | } s2; | ||
96 | } u2; | ||
97 | #endif | 93 | #endif |
98 | #ifdef INKERNEL | 94 | #ifdef INKERNEL |
99 | BYTE len ; | 95 | BYTE len; |
100 | BYTE control; | 96 | BYTE control; |
101 | #else | 97 | #else |
102 | union | 98 | union { |
103 | { | 99 | ushort control; |
104 | ushort control; | 100 | struct { |
105 | struct | 101 | unsigned char len; |
106 | { | 102 | unsigned char control; |
107 | unsigned char len; | 103 | } s3; |
108 | unsigned char control; | 104 | } u3; |
109 | } s3; | ||
110 | } u3; | ||
111 | #endif | 105 | #endif |
112 | BYTE data[PKT_MAX_DATA_LEN] ; | 106 | BYTE data[PKT_MAX_DATA_LEN]; |
113 | /* Actual data :-) */ | 107 | /* Actual data :-) */ |
114 | WORD csum ; /* C-SUM */ | 108 | WORD csum; /* C-SUM */ |
115 | } ; | 109 | }; |
116 | #endif | 110 | #endif |
117 | 111 | ||
118 | /*********** end of file ***********/ | 112 | /*********** end of file ***********/ |
119 | |||
120 | |||
diff --git a/drivers/char/rio/poll.h b/drivers/char/rio/poll.h index d9b8e983e175..9616ee4c6cd5 100644 --- a/drivers/char/rio/poll.h +++ b/drivers/char/rio/poll.h | |||
@@ -39,7 +39,7 @@ | |||
39 | 39 | ||
40 | #ifndef lint | 40 | #ifndef lint |
41 | #ifdef SCCS_LABELS | 41 | #ifdef SCCS_LABELS |
42 | static char *_rio_poll_h_sccs = "@(#)poll.h 1.2" ; | 42 | static char *_rio_poll_h_sccs = "@(#)poll.h 1.2"; |
43 | #endif | 43 | #endif |
44 | #endif | 44 | #endif |
45 | 45 | ||
@@ -54,23 +54,20 @@ static char *_rio_poll_h_sccs = "@(#)poll.h 1.2" ; | |||
54 | #define POLL_PERIOD (int) SECOND | 54 | #define POLL_PERIOD (int) SECOND |
55 | 55 | ||
56 | /* The various poll commands */ | 56 | /* The various poll commands */ |
57 | #define POLL_POLL 0 /* We are connected and happy.. */ | 57 | #define POLL_POLL 0 /* We are connected and happy.. */ |
58 | #define POLL_INTRO 1 /* Introduction packet */ | 58 | #define POLL_INTRO 1 /* Introduction packet */ |
59 | #define POLL_TOPOLOGY 2 /* Topology update */ | 59 | #define POLL_TOPOLOGY 2 /* Topology update */ |
60 | #define POLL_ASSIGN 3 /* ID assign */ | 60 | #define POLL_ASSIGN 3 /* ID assign */ |
61 | #define POLL_FOAD 4 /* F*** Off And Die */ | 61 | #define POLL_FOAD 4 /* F*** Off And Die */ |
62 | #define POLL_LMD 5 /* Let Me Die */ | 62 | #define POLL_LMD 5 /* Let Me Die */ |
63 | #define POLL_DYB 6 /* Die You Ba***** */ | 63 | #define POLL_DYB 6 /* Die You Ba***** */ |
64 | 64 | ||
65 | /* The way data fields are split up for POLL packets */ | 65 | /* The way data fields are split up for POLL packets */ |
66 | #define POLL_HOST_SERIAL 2 /* Host who booted me */ | 66 | #define POLL_HOST_SERIAL 2 /* Host who booted me */ |
67 | #define POLL_MY_SERIAL 6 /* My serial number */ | 67 | #define POLL_MY_SERIAL 6 /* My serial number */ |
68 | #define POLL_YOUR_ID 1 /* Your ID number */ | 68 | #define POLL_YOUR_ID 1 /* Your ID number */ |
69 | #define POLL_TOPOLOGY_FIELDS 2 /* Topology maps */ | 69 | #define POLL_TOPOLOGY_FIELDS 2 /* Topology maps */ |
70 | 70 | ||
71 | #endif | 71 | #endif |
72 | 72 | ||
73 | /*********** end of file ***********/ | 73 | /*********** end of file ***********/ |
74 | |||
75 | |||
76 | |||
diff --git a/drivers/char/rio/port.h b/drivers/char/rio/port.h index 8506af06aa9f..c99b1e70fdc8 100644 --- a/drivers/char/rio/port.h +++ b/drivers/char/rio/port.h | |||
@@ -46,96 +46,94 @@ static char *_port_h_sccs_ = "@(#)port.h 1.3"; | |||
46 | */ | 46 | */ |
47 | 47 | ||
48 | #ifdef STATS | 48 | #ifdef STATS |
49 | struct RIOStats | 49 | struct RIOStats { |
50 | { | ||
51 | /* | 50 | /* |
52 | ** interrupt statistics | 51 | ** interrupt statistics |
53 | */ | 52 | */ |
54 | uint BreakIntCnt; | 53 | uint BreakIntCnt; |
55 | uint ModemOffCnt; | 54 | uint ModemOffCnt; |
56 | uint ModemOnCnt; | 55 | uint ModemOnCnt; |
57 | uint RxIntCnt; | 56 | uint RxIntCnt; |
58 | uint TxIntCnt; | 57 | uint TxIntCnt; |
59 | /* | 58 | /* |
60 | ** throughput statistics | 59 | ** throughput statistics |
61 | */ | 60 | */ |
62 | uint RxCharCnt; | 61 | uint RxCharCnt; |
63 | uint RxPktCnt; | 62 | uint RxPktCnt; |
64 | uint RxSaveCnt; | 63 | uint RxSaveCnt; |
65 | uint TxCharCnt; | 64 | uint TxCharCnt; |
66 | uint TxPktCnt; | 65 | uint TxPktCnt; |
67 | /* | 66 | /* |
68 | ** driver entry statistics | 67 | ** driver entry statistics |
69 | */ | 68 | */ |
70 | uint CloseCnt; | 69 | uint CloseCnt; |
71 | uint IoctlCnt; | 70 | uint IoctlCnt; |
72 | uint OpenCnt; | 71 | uint OpenCnt; |
73 | uint ReadCnt; | 72 | uint ReadCnt; |
74 | uint WriteCnt; | 73 | uint WriteCnt; |
75 | /* | 74 | /* |
76 | ** proc statistics | 75 | ** proc statistics |
77 | */ | 76 | */ |
78 | uint BlockCnt; | 77 | uint BlockCnt; |
79 | uint OutputCnt; | 78 | uint OutputCnt; |
80 | uint ResumeCnt; | 79 | uint ResumeCnt; |
81 | uint RflushCnt; | 80 | uint RflushCnt; |
82 | uint SuspendCnt; | 81 | uint SuspendCnt; |
83 | uint TbreakCnt; | 82 | uint TbreakCnt; |
84 | uint TimeoutCnt; | 83 | uint TimeoutCnt; |
85 | uint UnblockCnt; | 84 | uint UnblockCnt; |
86 | uint WflushCnt; | 85 | uint WflushCnt; |
87 | uint WFBodgeCnt; | 86 | uint WFBodgeCnt; |
88 | }; | 87 | }; |
89 | #endif | 88 | #endif |
90 | 89 | ||
91 | /* | 90 | /* |
92 | ** Port data structure | 91 | ** Port data structure |
93 | */ | 92 | */ |
94 | struct Port | 93 | struct Port { |
95 | { | 94 | struct gs_port gs; |
96 | struct gs_port gs; | 95 | int PortNum; /* RIO port no., 0-511 */ |
97 | int PortNum; /* RIO port no., 0-511 */ | 96 | struct Host *HostP; |
98 | struct Host *HostP; | 97 | volatile caddr_t Caddr; |
99 | volatile caddr_t Caddr; | 98 | ushort HostPort; /* Port number on host card */ |
100 | ushort HostPort; /* Port number on host card */ | 99 | uchar RupNum; /* Number of RUP for port */ |
101 | uchar RupNum; /* Number of RUP for port */ | 100 | uchar ID2; /* Second ID of RTA for port */ |
102 | uchar ID2; /* Second ID of RTA for port */ | 101 | ulong State; /* FLAGS for open & xopen */ |
103 | ulong State; /* FLAGS for open & xopen */ | 102 | #define RIO_LOPEN 0x00001 /* Local open */ |
104 | #define RIO_LOPEN 0x00001 /* Local open */ | 103 | #define RIO_MOPEN 0x00002 /* Modem open */ |
105 | #define RIO_MOPEN 0x00002 /* Modem open */ | 104 | #define RIO_WOPEN 0x00004 /* Waiting for open */ |
106 | #define RIO_WOPEN 0x00004 /* Waiting for open */ | 105 | #define RIO_CLOSING 0x00008 /* The port is being close */ |
107 | #define RIO_CLOSING 0x00008 /* The port is being close */ | 106 | #define RIO_XPBUSY 0x00010 /* Transparent printer busy */ |
108 | #define RIO_XPBUSY 0x00010 /* Transparent printer busy */ | 107 | #define RIO_BREAKING 0x00020 /* Break in progress */ |
109 | #define RIO_BREAKING 0x00020 /* Break in progress */ | 108 | #define RIO_DIRECT 0x00040 /* Doing Direct output */ |
110 | #define RIO_DIRECT 0x00040 /* Doing Direct output */ | 109 | #define RIO_EXCLUSIVE 0x00080 /* Stream open for exclusive use */ |
111 | #define RIO_EXCLUSIVE 0x00080 /* Stream open for exclusive use */ | 110 | #define RIO_NDELAY 0x00100 /* Stream is open FNDELAY */ |
112 | #define RIO_NDELAY 0x00100 /* Stream is open FNDELAY */ | 111 | #define RIO_CARR_ON 0x00200 /* Stream has carrier present */ |
113 | #define RIO_CARR_ON 0x00200 /* Stream has carrier present */ | 112 | #define RIO_XPWANTR 0x00400 /* Stream wanted by Xprint */ |
114 | #define RIO_XPWANTR 0x00400 /* Stream wanted by Xprint */ | 113 | #define RIO_RBLK 0x00800 /* Stream is read-blocked */ |
115 | #define RIO_RBLK 0x00800 /* Stream is read-blocked */ | 114 | #define RIO_BUSY 0x01000 /* Stream is BUSY for write */ |
116 | #define RIO_BUSY 0x01000 /* Stream is BUSY for write */ | 115 | #define RIO_TIMEOUT 0x02000 /* Stream timeout in progress */ |
117 | #define RIO_TIMEOUT 0x02000 /* Stream timeout in progress */ | 116 | #define RIO_TXSTOP 0x04000 /* Stream output is stopped */ |
118 | #define RIO_TXSTOP 0x04000 /* Stream output is stopped */ | 117 | #define RIO_WAITFLUSH 0x08000 /* Stream waiting for flush */ |
119 | #define RIO_WAITFLUSH 0x08000 /* Stream waiting for flush */ | 118 | #define RIO_DYNOROD 0x10000 /* Drain failed */ |
120 | #define RIO_DYNOROD 0x10000 /* Drain failed */ | 119 | #define RIO_DELETED 0x20000 /* RTA has been deleted */ |
121 | #define RIO_DELETED 0x20000 /* RTA has been deleted */ | 120 | #define RIO_ISSCANCODE 0x40000 /* This line is in scancode mode */ |
122 | #define RIO_ISSCANCODE 0x40000 /* This line is in scancode mode */ | ||
123 | #define RIO_USING_EUC 0x100000 /* Using extended Unix chars */ | 121 | #define RIO_USING_EUC 0x100000 /* Using extended Unix chars */ |
124 | #define RIO_CAN_COOK 0x200000 /* This line can do cooking */ | 122 | #define RIO_CAN_COOK 0x200000 /* This line can do cooking */ |
125 | #define RIO_TRIAD_MODE 0x400000 /* Enable TRIAD special ops. */ | 123 | #define RIO_TRIAD_MODE 0x400000 /* Enable TRIAD special ops. */ |
126 | #define RIO_TRIAD_BLOCK 0x800000 /* Next read will block */ | 124 | #define RIO_TRIAD_BLOCK 0x800000 /* Next read will block */ |
127 | #define RIO_TRIAD_FUNC 0x1000000 /* Seen a function key coming in */ | 125 | #define RIO_TRIAD_FUNC 0x1000000 /* Seen a function key coming in */ |
128 | #define RIO_THROTTLE_RX 0x2000000 /* RX needs to be throttled. */ | 126 | #define RIO_THROTTLE_RX 0x2000000 /* RX needs to be throttled. */ |
129 | 127 | ||
130 | ulong Config; /* FLAGS for NOREAD.... */ | 128 | ulong Config; /* FLAGS for NOREAD.... */ |
131 | #define RIO_NOREAD 0x0001 /* Are not allowed to read port */ | 129 | #define RIO_NOREAD 0x0001 /* Are not allowed to read port */ |
132 | #define RIO_NOWRITE 0x0002 /* Are not allowed to write port */ | 130 | #define RIO_NOWRITE 0x0002 /* Are not allowed to write port */ |
133 | #define RIO_NOXPRINT 0x0004 /* Are not allowed to xprint port */ | 131 | #define RIO_NOXPRINT 0x0004 /* Are not allowed to xprint port */ |
134 | #define RIO_NOMASK 0x0007 /* All not allowed things */ | 132 | #define RIO_NOMASK 0x0007 /* All not allowed things */ |
135 | #define RIO_IXANY 0x0008 /* Port is allowed ixany */ | 133 | #define RIO_IXANY 0x0008 /* Port is allowed ixany */ |
136 | #define RIO_MODEM 0x0010 /* Stream is a modem device */ | 134 | #define RIO_MODEM 0x0010 /* Stream is a modem device */ |
137 | #define RIO_IXON 0x0020 /* Port is allowed ixon */ | 135 | #define RIO_IXON 0x0020 /* Port is allowed ixon */ |
138 | #define RIO_WAITDRAIN 0x0040 /* Wait for port to completely drain */ | 136 | #define RIO_WAITDRAIN 0x0040 /* Wait for port to completely drain */ |
139 | #define RIO_MAP_50_TO_50 0x0080 /* Map 50 baud to 50 baud */ | 137 | #define RIO_MAP_50_TO_50 0x0080 /* Map 50 baud to 50 baud */ |
140 | #define RIO_MAP_110_TO_110 0x0100 /* Map 110 baud to 110 baud */ | 138 | #define RIO_MAP_110_TO_110 0x0100 /* Map 110 baud to 110 baud */ |
141 | 139 | ||
@@ -144,92 +142,90 @@ struct Port | |||
144 | ** As LynxOS does not appear to support Hardware Flow Control ..... | 142 | ** As LynxOS does not appear to support Hardware Flow Control ..... |
145 | ** Define our own flow control flags in 'Config'. | 143 | ** Define our own flow control flags in 'Config'. |
146 | */ | 144 | */ |
147 | #define RIO_CTSFLOW 0x0200 /* RIO's own CTSFLOW flag */ | 145 | #define RIO_CTSFLOW 0x0200 /* RIO's own CTSFLOW flag */ |
148 | #define RIO_RTSFLOW 0x0400 /* RIO's own RTSFLOW flag */ | 146 | #define RIO_RTSFLOW 0x0400 /* RIO's own RTSFLOW flag */ |
149 | 147 | ||
150 | 148 | ||
151 | struct PHB *PhbP; /* pointer to PHB for port */ | 149 | struct PHB *PhbP; /* pointer to PHB for port */ |
152 | WORD *TxAdd; /* Add packets here */ | 150 | WORD *TxAdd; /* Add packets here */ |
153 | WORD *TxStart; /* Start of add array */ | 151 | WORD *TxStart; /* Start of add array */ |
154 | WORD *TxEnd; /* End of add array */ | 152 | WORD *TxEnd; /* End of add array */ |
155 | WORD *RxRemove; /* Remove packets here */ | 153 | WORD *RxRemove; /* Remove packets here */ |
156 | WORD *RxStart; /* Start of remove array */ | 154 | WORD *RxStart; /* Start of remove array */ |
157 | WORD *RxEnd; /* End of remove array */ | 155 | WORD *RxEnd; /* End of remove array */ |
158 | uint RtaUniqueNum; /* Unique number of RTA */ | 156 | uint RtaUniqueNum; /* Unique number of RTA */ |
159 | ushort PortState; /* status of port */ | 157 | ushort PortState; /* status of port */ |
160 | ushort ModemState; /* status of modem lines */ | 158 | ushort ModemState; /* status of modem lines */ |
161 | ulong ModemLines; /* Modem bits sent to RTA */ | 159 | ulong ModemLines; /* Modem bits sent to RTA */ |
162 | uchar CookMode; /* who expands CR/LF? */ | 160 | uchar CookMode; /* who expands CR/LF? */ |
163 | uchar ParamSem; /* Prevent write during param */ | 161 | uchar ParamSem; /* Prevent write during param */ |
164 | uchar Mapped; /* if port mapped onto host */ | 162 | uchar Mapped; /* if port mapped onto host */ |
165 | uchar SecondBlock; /* if port belongs to 2nd block | 163 | uchar SecondBlock; /* if port belongs to 2nd block |
166 | of 16 port RTA */ | 164 | of 16 port RTA */ |
167 | uchar InUse; /* how many pre-emptive cmds */ | 165 | uchar InUse; /* how many pre-emptive cmds */ |
168 | uchar Lock; /* if params locked */ | 166 | uchar Lock; /* if params locked */ |
169 | uchar Store; /* if params stored across closes */ | 167 | uchar Store; /* if params stored across closes */ |
170 | uchar FirstOpen; /* TRUE if first time port opened */ | 168 | uchar FirstOpen; /* TRUE if first time port opened */ |
171 | uchar FlushCmdBodge; /* if doing a (non)flush */ | 169 | uchar FlushCmdBodge; /* if doing a (non)flush */ |
172 | uchar MagicFlags; /* require intr processing */ | 170 | uchar MagicFlags; /* require intr processing */ |
173 | #define MAGIC_FLUSH 0x01 /* mirror of WflushFlag */ | 171 | #define MAGIC_FLUSH 0x01 /* mirror of WflushFlag */ |
174 | #define MAGIC_REBOOT 0x02 /* RTA re-booted, re-open ports */ | 172 | #define MAGIC_REBOOT 0x02 /* RTA re-booted, re-open ports */ |
175 | #define MORE_OUTPUT_EYGOR 0x04 /* riotproc failed to empty clists */ | 173 | #define MORE_OUTPUT_EYGOR 0x04 /* riotproc failed to empty clists */ |
176 | uchar WflushFlag; /* 1 How many WFLUSHs active */ | 174 | uchar WflushFlag; /* 1 How many WFLUSHs active */ |
177 | /* | 175 | /* |
178 | ** Transparent print stuff | 176 | ** Transparent print stuff |
179 | */ | 177 | */ |
180 | struct Xprint | 178 | struct Xprint { |
181 | { | ||
182 | #ifndef MAX_XP_CTRL_LEN | 179 | #ifndef MAX_XP_CTRL_LEN |
183 | #define MAX_XP_CTRL_LEN 16 /* ALSO IN DAEMON.H */ | 180 | #define MAX_XP_CTRL_LEN 16 /* ALSO IN DAEMON.H */ |
184 | #endif | 181 | #endif |
185 | uint XpCps; | 182 | uint XpCps; |
186 | char XpOn[MAX_XP_CTRL_LEN]; | 183 | char XpOn[MAX_XP_CTRL_LEN]; |
187 | char XpOff[MAX_XP_CTRL_LEN]; | 184 | char XpOff[MAX_XP_CTRL_LEN]; |
188 | ushort XpLen; /* strlen(XpOn)+strlen(XpOff) */ | 185 | ushort XpLen; /* strlen(XpOn)+strlen(XpOff) */ |
189 | uchar XpActive; | 186 | uchar XpActive; |
190 | uchar XpLastTickOk; /* TRUE if we can process */ | 187 | uchar XpLastTickOk; /* TRUE if we can process */ |
191 | #define XP_OPEN 00001 | 188 | #define XP_OPEN 00001 |
192 | #define XP_RUNABLE 00002 | 189 | #define XP_RUNABLE 00002 |
193 | struct ttystatics *XttyP; | 190 | struct ttystatics *XttyP; |
194 | } Xprint; | 191 | } Xprint; |
195 | #ifdef VPIX | 192 | #ifdef VPIX |
196 | v86_t *StashP; | 193 | v86_t *StashP; |
197 | uint IntMask; | 194 | uint IntMask; |
198 | struct termss VpixSs; | 195 | struct termss VpixSs; |
199 | uchar ModemStatusReg; /* Modem status register */ | 196 | uchar ModemStatusReg; /* Modem status register */ |
200 | #endif | 197 | #endif |
201 | uchar RxDataStart; | 198 | uchar RxDataStart; |
202 | uchar Cor2Copy; /* copy of COR2 */ | 199 | uchar Cor2Copy; /* copy of COR2 */ |
203 | char *Name; /* points to the Rta's name */ | 200 | char *Name; /* points to the Rta's name */ |
204 | #ifdef STATS | 201 | #ifdef STATS |
205 | struct RIOStats Stat; /* ports statistics */ | 202 | struct RIOStats Stat; /* ports statistics */ |
206 | #endif | 203 | #endif |
207 | char *TxRingBuffer; | 204 | char *TxRingBuffer; |
208 | ushort TxBufferIn; /* New data arrives here */ | 205 | ushort TxBufferIn; /* New data arrives here */ |
209 | ushort TxBufferOut; /* Intr removes data here */ | 206 | ushort TxBufferOut; /* Intr removes data here */ |
210 | ushort OldTxBufferOut; /* Indicates if draining */ | 207 | ushort OldTxBufferOut; /* Indicates if draining */ |
211 | int TimeoutId; /* Timeout ID */ | 208 | int TimeoutId; /* Timeout ID */ |
212 | uint Debug; | 209 | uint Debug; |
213 | uchar WaitUntilBooted; /* True if open should block */ | 210 | uchar WaitUntilBooted; /* True if open should block */ |
214 | uint statsGather; /* True if gathering stats */ | 211 | uint statsGather; /* True if gathering stats */ |
215 | ulong txchars; /* Chars transmitted */ | 212 | ulong txchars; /* Chars transmitted */ |
216 | ulong rxchars; /* Chars received */ | 213 | ulong rxchars; /* Chars received */ |
217 | ulong opens; /* port open count */ | 214 | ulong opens; /* port open count */ |
218 | ulong closes; /* port close count */ | 215 | ulong closes; /* port close count */ |
219 | ulong ioctls; /* ioctl count */ | 216 | ulong ioctls; /* ioctl count */ |
220 | uchar LastRxTgl; /* Last state of rx toggle bit */ | 217 | uchar LastRxTgl; /* Last state of rx toggle bit */ |
221 | spinlock_t portSem; /* Lock using this sem */ | 218 | spinlock_t portSem; /* Lock using this sem */ |
222 | int MonitorTstate; /* Monitoring ? */ | 219 | int MonitorTstate; /* Monitoring ? */ |
223 | int timeout_id; /* For calling 100 ms delays */ | 220 | int timeout_id; /* For calling 100 ms delays */ |
224 | int timeout_sem;/* For calling 100 ms delays */ | 221 | int timeout_sem; /* For calling 100 ms delays */ |
225 | int firstOpen; /* First time open ? */ | 222 | int firstOpen; /* First time open ? */ |
226 | char * p; /* save the global struc here .. */ | 223 | char *p; /* save the global struc here .. */ |
227 | }; | 224 | }; |
228 | 225 | ||
229 | struct ModuleInfo | 226 | struct ModuleInfo { |
230 | { | 227 | char *Name; |
231 | char *Name; | 228 | uint Flags[4]; /* one per port on a module */ |
232 | uint Flags[4]; /* one per port on a module */ | ||
233 | }; | 229 | }; |
234 | #endif | 230 | #endif |
235 | 231 | ||
@@ -238,8 +234,8 @@ struct ModuleInfo | |||
238 | ** runs into problems with differing struct sizes between driver and config. | 234 | ** runs into problems with differing struct sizes between driver and config. |
239 | */ | 235 | */ |
240 | struct PortParams { | 236 | struct PortParams { |
241 | uint Port; | 237 | uint Port; |
242 | ulong Config; | 238 | ulong Config; |
243 | ulong State; | 239 | ulong State; |
244 | struct ttystatics *TtyP; | 240 | struct ttystatics *TtyP; |
245 | }; | 241 | }; |
diff --git a/drivers/char/rio/proto.h b/drivers/char/rio/proto.h index ddff0ef84e3a..f9a3376333e5 100644 --- a/drivers/char/rio/proto.h +++ b/drivers/char/rio/proto.h | |||
@@ -23,15 +23,15 @@ | |||
23 | /* | 23 | /* |
24 | ** boot.c | 24 | ** boot.c |
25 | */ | 25 | */ |
26 | void init_boot( char *p, short stage); | 26 | void init_boot(char *p, short stage); |
27 | 27 | ||
28 | /* | 28 | /* |
29 | ** disconct.c | 29 | ** disconct.c |
30 | */ | 30 | */ |
31 | void kill_boot ( LPB *link ); | 31 | void kill_boot(LPB * link); |
32 | void disconnected( LPB *link ); | 32 | void disconnected(LPB * link); |
33 | short boot_3( LPB *link, PKT *pkt ); | 33 | short boot_3(LPB * link, PKT * pkt); |
34 | short send_3_pkt( LPB *link, PKT *pkt); | 34 | short send_3_pkt(LPB * link, PKT * pkt); |
35 | 35 | ||
36 | /* | 36 | /* |
37 | ** error.c | 37 | ** error.c |
@@ -41,116 +41,116 @@ void du_error(void); | |||
41 | /* | 41 | /* |
42 | ** formpkt.c | 42 | ** formpkt.c |
43 | */ | 43 | */ |
44 | ushort sum_it( PKT *pkt ) ; | 44 | ushort sum_it(PKT * pkt); |
45 | void form_rup_pkt( RUP *form_rup, PKT *pkt ); | 45 | void form_rup_pkt(RUP * form_rup, PKT * pkt); |
46 | void form_poll_pkt ( int type, LPB *link, int node ); | 46 | void form_poll_pkt(int type, LPB * link, int node); |
47 | void form_route_pkt ( int type, PKT *pkt, LPB *link ); | 47 | void form_route_pkt(int type, PKT * pkt, LPB * link); |
48 | 48 | ||
49 | /* | 49 | /* |
50 | ** idle.c | 50 | ** idle.c |
51 | */ | 51 | */ |
52 | void idle( Process *idle_p ); | 52 | void idle(Process * idle_p); |
53 | 53 | ||
54 | /* | 54 | /* |
55 | ** init.c | 55 | ** init.c |
56 | */ | 56 | */ |
57 | void general_init(void); | 57 | void general_init(void); |
58 | void mem_halt( int error); | 58 | void mem_halt(int error); |
59 | 59 | ||
60 | /* | 60 | /* |
61 | ** linkinit.c | 61 | ** linkinit.c |
62 | */ | 62 | */ |
63 | void initlink( u_short number, LPB *link); | 63 | void initlink(u_short number, LPB * link); |
64 | void runlink( LPB *link); | 64 | void runlink(LPB * link); |
65 | 65 | ||
66 | /* | 66 | /* |
67 | ** list.c | 67 | ** list.c |
68 | */ | 68 | */ |
69 | PKT *get_free_start(void); | 69 | PKT *get_free_start(void); |
70 | void put_free_start( PKT *pkt); | 70 | void put_free_start(PKT * pkt); |
71 | 71 | ||
72 | #ifdef HOST | 72 | #ifdef HOST |
73 | int can_remove_transmit ( PKT **pkt, PKT *pointer ); | 73 | int can_remove_transmit(PKT ** pkt, PKT * pointer); |
74 | #endif | 74 | #endif |
75 | 75 | ||
76 | #ifdef RTA | 76 | #ifdef RTA |
77 | int spl7 ( void ); | 77 | int spl7(void); |
78 | int spl0 ( void ); | 78 | int spl0(void); |
79 | Q_BUF *get_free_q( void ); | 79 | Q_BUF *get_free_q(void); |
80 | PKT *get_free_end(void); | 80 | PKT *get_free_end(void); |
81 | int add_end( PKT *pkt, PHB *phb, int type); | 81 | int add_end(PKT * pkt, PHB * phb, int type); |
82 | unsigned short free_packets( PHB *phb, int type); | 82 | unsigned short free_packets(PHB * phb, int type); |
83 | int can_remove_start( PKT **pkt, PHB *phb, int type); | 83 | int can_remove_start(PKT ** pkt, PHB * phb, int type); |
84 | int can_add_start( PHB *phb, int type); | 84 | int can_add_start(PHB * phb, int type); |
85 | int can_add_end( PHB *phb, int type); | 85 | int can_add_end(PHB * phb, int type); |
86 | void put_free_end( PKT *pkt); | 86 | void put_free_end(PKT * pkt); |
87 | int remove_start( PKT **pkt, PHB *phb, int type); | 87 | int remove_start(PKT ** pkt, PHB * phb, int type); |
88 | #endif | 88 | #endif |
89 | 89 | ||
90 | /* | 90 | /* |
91 | ** Lrt.c | 91 | ** Lrt.c |
92 | */ | 92 | */ |
93 | void lrt( Process *lrt_p, LPB *link ); | 93 | void lrt(Process * lrt_p, LPB * link); |
94 | 94 | ||
95 | #ifdef RTA | 95 | #ifdef RTA |
96 | void set_led_red ( LPB *link ); | 96 | void set_led_red(LPB * link); |
97 | #endif | 97 | #endif |
98 | 98 | ||
99 | /* | 99 | /* |
100 | ** ltt.c | 100 | ** ltt.c |
101 | */ | 101 | */ |
102 | void ltt( Process *ltt_p, LPB *link, PHB *phb_ptr[] ); | 102 | void ltt(Process * ltt_p, LPB * link, PHB * phb_ptr[]); |
103 | void send_poll ( LPB *link ); | 103 | void send_poll(LPB * link); |
104 | void request_id ( LPB *link ); | 104 | void request_id(LPB * link); |
105 | void send_topology_update ( LPB *link ); | 105 | void send_topology_update(LPB * link); |
106 | void send_topology ( LPB *link ); | 106 | void send_topology(LPB * link); |
107 | void supply_id ( LPB *link ); | 107 | void supply_id(LPB * link); |
108 | 108 | ||
109 | #ifdef RTA | 109 | #ifdef RTA |
110 | void redirect_queue ( LPB *link, ushort flush ); | 110 | void redirect_queue(LPB * link, ushort flush); |
111 | int obtain_rup ( int rup_number, PKT **pkt_address, LPB *link ); | 111 | int obtain_rup(int rup_number, PKT ** pkt_address, LPB * link); |
112 | #endif | 112 | #endif |
113 | 113 | ||
114 | #ifdef TESTING_PERF | 114 | #ifdef TESTING_PERF |
115 | int consume_cpu( void ); | 115 | int consume_cpu(void); |
116 | #endif | 116 | #endif |
117 | 117 | ||
118 | /* | 118 | /* |
119 | ** lttwake.c | 119 | ** lttwake.c |
120 | */ | 120 | */ |
121 | #ifdef HOST | 121 | #ifdef HOST |
122 | void ltt_wakeup( Process *ltt_wakeup_p ); | 122 | void ltt_wakeup(Process * ltt_wakeup_p); |
123 | #endif | 123 | #endif |
124 | 124 | ||
125 | /* | 125 | /* |
126 | ** mapgen.c | 126 | ** mapgen.c |
127 | */ | 127 | */ |
128 | void generate_id_map( short mapping, ROUTE_STR route[] ); | 128 | void generate_id_map(short mapping, ROUTE_STR route[]); |
129 | void gen_map( int mapping, int looking_at, int come_from, ROUTE_STR route[], int link, int *ttl ); | 129 | void gen_map(int mapping, int looking_at, int come_from, ROUTE_STR route[], int link, int *ttl); |
130 | void adjust_ttl( int mapping, int looking_at, int come_from, ROUTE_STR route[], int link, int *ttl); | 130 | void adjust_ttl(int mapping, int looking_at, int come_from, ROUTE_STR route[], int link, int *ttl); |
131 | void init_sys_map(void); | 131 | void init_sys_map(void); |
132 | 132 | ||
133 | /* | 133 | /* |
134 | ** mmu.c | 134 | ** mmu.c |
135 | */ | 135 | */ |
136 | char *rio_malloc( unsigned int amount); | 136 | char *rio_malloc(unsigned int amount); |
137 | char *rio_calloc( unsigned int num, unsigned int size); | 137 | char *rio_calloc(unsigned int num, unsigned int size); |
138 | ERROR rio_mmu_init( uint total_mem ); | 138 | ERROR rio_mmu_init(uint total_mem); |
139 | 139 | ||
140 | /* | 140 | /* |
141 | ** partn.c | 141 | ** partn.c |
142 | */ | 142 | */ |
143 | void partition_tx( struct PHB *phb, u_short tx_size, u_short rx_size, u_short rx_limit); | 143 | void partition_tx(struct PHB *phb, u_short tx_size, u_short rx_size, u_short rx_limit); |
144 | 144 | ||
145 | /* | 145 | /* |
146 | ** poll.c | 146 | ** poll.c |
147 | */ | 147 | */ |
148 | void tx_poll( Process *tx_poll_p); | 148 | void tx_poll(Process * tx_poll_p); |
149 | 149 | ||
150 | /* | 150 | /* |
151 | ** process.c | 151 | ** process.c |
152 | */ | 152 | */ |
153 | int get_proc_space( Process **pd, int **pws, int wssize); | 153 | int get_proc_space(Process ** pd, int **pws, int wssize); |
154 | 154 | ||
155 | /* | 155 | /* |
156 | ** readrom.c | 156 | ** readrom.c |
@@ -160,85 +160,85 @@ void read_serial_number(char *buf); | |||
160 | /* | 160 | /* |
161 | ** rio.c | 161 | ** rio.c |
162 | */ | 162 | */ |
163 | int main( void ); | 163 | int main(void); |
164 | 164 | ||
165 | /* | 165 | /* |
166 | ** route.c | 166 | ** route.c |
167 | */ | 167 | */ |
168 | void route_update ( PKT *pkt, LPB *link); | 168 | void route_update(PKT * pkt, LPB * link); |
169 | 169 | ||
170 | /* | 170 | /* |
171 | ** rtainit.c | 171 | ** rtainit.c |
172 | */ | 172 | */ |
173 | #if defined(RTA) | 173 | #if defined(RTA) |
174 | void rta_init(ushort RtaType); | 174 | void rta_init(ushort RtaType); |
175 | #endif /* defined(RTA) */ | 175 | #endif /* defined(RTA) */ |
176 | 176 | ||
177 | /* | 177 | /* |
178 | ** rupboot.c | 178 | ** rupboot.c |
179 | */ | 179 | */ |
180 | void rup_boot( PKT *pkt, RUP *this_rup, LPB *link); | 180 | void rup_boot(PKT * pkt, RUP * this_rup, LPB * link); |
181 | 181 | ||
182 | #ifdef RTA | 182 | #ifdef RTA |
183 | void kill_your_neighbour( int link_to_kill ); | 183 | void kill_your_neighbour(int link_to_kill); |
184 | #endif | 184 | #endif |
185 | 185 | ||
186 | /* | 186 | /* |
187 | ** rupcmd.c | 187 | ** rupcmd.c |
188 | */ | 188 | */ |
189 | void rup_command( PKT *pkt, struct RUP *this_rup, LPB *link); | 189 | void rup_command(PKT * pkt, struct RUP *this_rup, LPB * link); |
190 | 190 | ||
191 | /* | 191 | /* |
192 | ** ruperr.c | 192 | ** ruperr.c |
193 | */ | 193 | */ |
194 | void rup_error( PKT *pkt, RUP *this_rup, LPB *link ); | 194 | void rup_error(PKT * pkt, RUP * this_rup, LPB * link); |
195 | void illegal_cmd( PKT *src_pkt ); | 195 | void illegal_cmd(PKT * src_pkt); |
196 | 196 | ||
197 | /* | 197 | /* |
198 | ** ruppoll.c | 198 | ** ruppoll.c |
199 | */ | 199 | */ |
200 | void rup_poll( PKT *pkt, RUP *this_rup, LPB *link ); | 200 | void rup_poll(PKT * pkt, RUP * this_rup, LPB * link); |
201 | 201 | ||
202 | /* | 202 | /* |
203 | ** ruppower.c | 203 | ** ruppower.c |
204 | */ | 204 | */ |
205 | void rup_power( PKT *pkt, RUP *this_rup, LPB *link ); | 205 | void rup_power(PKT * pkt, RUP * this_rup, LPB * link); |
206 | 206 | ||
207 | /* | 207 | /* |
208 | ** ruprm.c | 208 | ** ruprm.c |
209 | */ | 209 | */ |
210 | void rup_route_map( PKT *pkt, RUP *this_rup, LPB *link); | 210 | void rup_route_map(PKT * pkt, RUP * this_rup, LPB * link); |
211 | 211 | ||
212 | /* | 212 | /* |
213 | ** rupstat.c | 213 | ** rupstat.c |
214 | */ | 214 | */ |
215 | void rup_status( PKT *pkt, RUP *this_rup, LPB *link); | 215 | void rup_status(PKT * pkt, RUP * this_rup, LPB * link); |
216 | 216 | ||
217 | /* | 217 | /* |
218 | ** rupsync.c | 218 | ** rupsync.c |
219 | */ | 219 | */ |
220 | void rup_sync( PKT *pkt); | 220 | void rup_sync(PKT * pkt); |
221 | 221 | ||
222 | /* | 222 | /* |
223 | ** rxpkt.c | 223 | ** rxpkt.c |
224 | */ | 224 | */ |
225 | ERROR rx_pkt( PKT_ptr_ptr pkt_address, LPB *link); | 225 | ERROR rx_pkt(PKT_ptr_ptr pkt_address, LPB * link); |
226 | 226 | ||
227 | /* | 227 | /* |
228 | ** sendsts.c | 228 | ** sendsts.c |
229 | */ | 229 | */ |
230 | void send_status( PKT *requesting_pkt, RUP *this_rup); | 230 | void send_status(PKT * requesting_pkt, RUP * this_rup); |
231 | 231 | ||
232 | /* | 232 | /* |
233 | ** serial.c | 233 | ** serial.c |
234 | */ | 234 | */ |
235 | void assign_serial ( char *ser_in, char *ser_out); | 235 | void assign_serial(char *ser_in, char *ser_out); |
236 | int cmp_serial ( char *ser_1, char *ser_2); | 236 | int cmp_serial(char *ser_1, char *ser_2); |
237 | 237 | ||
238 | /* | 238 | /* |
239 | ** txpkt.c | 239 | ** txpkt.c |
240 | */ | 240 | */ |
241 | ERROR tx_pkt( PKT *pkt, LPB *link); | 241 | ERROR tx_pkt(PKT * pkt, LPB * link); |
242 | short send_sync( LPB *link); | 242 | short send_sync(LPB * link); |
243 | 243 | ||
244 | #endif /* _prototypes_h */ | 244 | #endif /* _prototypes_h */ |
diff --git a/drivers/char/rio/protsts.h b/drivers/char/rio/protsts.h index 848111ac9380..69fc4bc34153 100644 --- a/drivers/char/rio/protsts.h +++ b/drivers/char/rio/protsts.h | |||
@@ -115,5 +115,3 @@ | |||
115 | #endif | 115 | #endif |
116 | 116 | ||
117 | /*********** end of file ***********/ | 117 | /*********** end of file ***********/ |
118 | |||
119 | |||
diff --git a/drivers/char/rio/qbuf.h b/drivers/char/rio/qbuf.h index 1fce02f8fcfc..acd9e8e5307d 100644 --- a/drivers/char/rio/qbuf.h +++ b/drivers/char/rio/qbuf.h | |||
@@ -40,7 +40,7 @@ | |||
40 | 40 | ||
41 | #ifndef lint | 41 | #ifndef lint |
42 | #ifdef SCCS_LABELS | 42 | #ifdef SCCS_LABELS |
43 | static char *_rio_qbuf_h_sccs = "@(#)qbuf.h 1.1" ; | 43 | static char *_rio_qbuf_h_sccs = "@(#)qbuf.h 1.1"; |
44 | #endif | 44 | #endif |
45 | #endif | 45 | #endif |
46 | 46 | ||
@@ -52,16 +52,15 @@ static char *_rio_qbuf_h_sccs = "@(#)qbuf.h 1.1" ; | |||
52 | #define PKTS_PER_BUFFER (220 / PKT_LENGTH) | 52 | #define PKTS_PER_BUFFER (220 / PKT_LENGTH) |
53 | #endif | 53 | #endif |
54 | 54 | ||
55 | typedef struct Q_BUF Q_BUF ; | 55 | typedef struct Q_BUF Q_BUF; |
56 | struct Q_BUF { | 56 | struct Q_BUF { |
57 | Q_BUF_ptr next ; | 57 | Q_BUF_ptr next; |
58 | Q_BUF_ptr prev ; | 58 | Q_BUF_ptr prev; |
59 | PKT_ptr buf[PKTS_PER_BUFFER] ; | 59 | PKT_ptr buf[PKTS_PER_BUFFER]; |
60 | } ; | 60 | }; |
61 | 61 | ||
62 | 62 | ||
63 | #endif | 63 | #endif |
64 | 64 | ||
65 | 65 | ||
66 | /*********** end of file ***********/ | 66 | /*********** end of file ***********/ |
67 | |||
diff --git a/drivers/char/rio/rio.h b/drivers/char/rio/rio.h index 13a9931958b1..7f45e1ab5332 100644 --- a/drivers/char/rio/rio.h +++ b/drivers/char/rio/rio.h | |||
@@ -72,8 +72,8 @@ static char *_rio_h_sccs_ = "@(#)rio.h 1.3"; | |||
72 | #define RIO_HOSTS 4 /* number of hosts that can be found */ | 72 | #define RIO_HOSTS 4 /* number of hosts that can be found */ |
73 | #define PORTS_PER_HOST 128 /* number of ports per host */ | 73 | #define PORTS_PER_HOST 128 /* number of ports per host */ |
74 | #define LINKS_PER_UNIT 4 /* number of links from a host */ | 74 | #define LINKS_PER_UNIT 4 /* number of links from a host */ |
75 | #define RIO_PORTS (PORTS_PER_HOST * RIO_HOSTS) /* max. no. of ports */ | 75 | #define RIO_PORTS (PORTS_PER_HOST * RIO_HOSTS) /* max. no. of ports */ |
76 | #define RTAS_PER_HOST (MAX_RUP) /* number of RTAs per host */ | 76 | #define RTAS_PER_HOST (MAX_RUP) /* number of RTAs per host */ |
77 | #define PORTS_PER_RTA (PORTS_PER_HOST/RTAS_PER_HOST) /* ports on a rta */ | 77 | #define PORTS_PER_RTA (PORTS_PER_HOST/RTAS_PER_HOST) /* ports on a rta */ |
78 | #define PORTS_PER_MODULE 4 /* number of ports on a plug-in module */ | 78 | #define PORTS_PER_MODULE 4 /* number of ports on a plug-in module */ |
79 | /* number of modules on an RTA */ | 79 | /* number of modules on an RTA */ |
@@ -216,10 +216,9 @@ static char *_rio_h_sccs_ = "@(#)rio.h 1.3"; | |||
216 | #define RIO_PRI (PZERO+10) | 216 | #define RIO_PRI (PZERO+10) |
217 | #define RIO_CLOSE_PRI PZERO-1 /* uninterruptible sleeps for close */ | 217 | #define RIO_CLOSE_PRI PZERO-1 /* uninterruptible sleeps for close */ |
218 | 218 | ||
219 | typedef struct DbInf | 219 | typedef struct DbInf { |
220 | { | 220 | uint Flag; |
221 | uint Flag; | 221 | char Name[8]; |
222 | char Name[8]; | ||
223 | } DbInf; | 222 | } DbInf; |
224 | 223 | ||
225 | #ifndef TRUE | 224 | #ifndef TRUE |
@@ -251,7 +250,7 @@ typedef struct DbInf | |||
251 | *((uint *)PK) = PP->PacketInfo; \ | 250 | *((uint *)PK) = PP->PacketInfo; \ |
252 | } | 251 | } |
253 | 252 | ||
254 | #define RIO_LINK_ENABLE 0x80FF /* FF is a hack, mainly for Mips, to */ | 253 | #define RIO_LINK_ENABLE 0x80FF /* FF is a hack, mainly for Mips, to */ |
255 | /* prevent a really stupid race condition. */ | 254 | /* prevent a really stupid race condition. */ |
256 | 255 | ||
257 | #define NOT_INITIALISED 0 | 256 | #define NOT_INITIALISED 0 |
@@ -291,4 +290,4 @@ typedef struct DbInf | |||
291 | #define DIST_LINESW_OUTPUT 0x40 | 290 | #define DIST_LINESW_OUTPUT 0x40 |
292 | #define DIST_LINESW_MDMINT 0x80 | 291 | #define DIST_LINESW_MDMINT 0x80 |
293 | 292 | ||
294 | #endif /* __rio_h__ */ | 293 | #endif /* __rio_h__ */ |
diff --git a/drivers/char/rio/rio_linux.c b/drivers/char/rio/rio_linux.c index 7085a38532b3..8825bd61b7d0 100644 --- a/drivers/char/rio/rio_linux.c +++ b/drivers/char/rio/rio_linux.c | |||
@@ -33,7 +33,7 @@ | |||
33 | * */ | 33 | * */ |
34 | 34 | ||
35 | #include <linux/module.h> | 35 | #include <linux/module.h> |
36 | #include <linux/config.h> | 36 | #include <linux/config.h> |
37 | #include <linux/kdev_t.h> | 37 | #include <linux/kdev_t.h> |
38 | #include <asm/io.h> | 38 | #include <asm/io.h> |
39 | #include <linux/kernel.h> | 39 | #include <linux/kernel.h> |
@@ -112,7 +112,7 @@ more than 512 ports.... */ | |||
112 | #define PCI_DEVICE_ID_SPECIALIX_SX_XIO_IO8 0x2000 | 112 | #define PCI_DEVICE_ID_SPECIALIX_SX_XIO_IO8 0x2000 |
113 | #endif | 113 | #endif |
114 | 114 | ||
115 | #ifndef RIO_WINDOW_LEN | 115 | #ifndef RIO_WINDOW_LEN |
116 | #define RIO_WINDOW_LEN 0x10000 | 116 | #define RIO_WINDOW_LEN 0x10000 |
117 | #endif | 117 | #endif |
118 | 118 | ||
@@ -140,34 +140,51 @@ more than 512 ports.... */ | |||
140 | */ | 140 | */ |
141 | #define RIO_REPORT_FIFO | 141 | #define RIO_REPORT_FIFO |
142 | #define RIO_REPORT_OVERRUN | 142 | #define RIO_REPORT_OVERRUN |
143 | #endif | 143 | #endif |
144 | 144 | ||
145 | 145 | ||
146 | /* These constants are derived from SCO Source */ | 146 | /* These constants are derived from SCO Source */ |
147 | static struct Conf | 147 | static struct Conf |
148 | RIOConf = | 148 | RIOConf = { |
149 | { | 149 | /* locator */ "RIO Config here", |
150 | /* locator */ "RIO Config here", | 150 | /* startuptime */ HZ * 2, |
151 | /* startuptime */ HZ*2, /* how long to wait for card to run */ | 151 | /* how long to wait for card to run */ |
152 | /* slowcook */ 0, /* TRUE -> always use line disc. */ | 152 | /* slowcook */ 0, |
153 | /* intrpolltime */ 1, /* The frequency of OUR polls */ | 153 | /* TRUE -> always use line disc. */ |
154 | /* breakinterval */ 25, /* x10 mS XXX: units seem to be 1ms not 10! -- REW*/ | 154 | /* intrpolltime */ 1, |
155 | /* timer */ 10, /* mS */ | 155 | /* The frequency of OUR polls */ |
156 | /* RtaLoadBase */ 0x7000, | 156 | /* breakinterval */ 25, |
157 | /* HostLoadBase */ 0x7C00, | 157 | /* x10 mS XXX: units seem to be 1ms not 10! -- REW */ |
158 | /* XpHz */ 5, /* number of Xprint hits per second */ | 158 | /* timer */ 10, |
159 | /* XpCps */ 120, /* Xprint characters per second */ | 159 | /* mS */ |
160 | /* XpOn */ "\033d#", /* start Xprint for a wyse 60 */ | 160 | /* RtaLoadBase */ 0x7000, |
161 | /* XpOff */ "\024", /* end Xprint for a wyse 60 */ | 161 | /* HostLoadBase */ 0x7C00, |
162 | /* MaxXpCps */ 2000, /* highest Xprint speed */ | 162 | /* XpHz */ 5, |
163 | /* MinXpCps */ 10, /* slowest Xprint speed */ | 163 | /* number of Xprint hits per second */ |
164 | /* SpinCmds */ 1, /* non-zero for mega fast boots */ | 164 | /* XpCps */ 120, |
165 | /* First Addr */ 0x0A0000, /* First address to look at */ | 165 | /* Xprint characters per second */ |
166 | /* Last Addr */ 0xFF0000, /* Last address looked at */ | 166 | /* XpOn */ "\033d#", |
167 | /* BufferSize */ 1024, /* Bytes per port of buffering */ | 167 | /* start Xprint for a wyse 60 */ |
168 | /* LowWater */ 256, /* how much data left before wakeup */ | 168 | /* XpOff */ "\024", |
169 | /* LineLength */ 80, /* how wide is the console? */ | 169 | /* end Xprint for a wyse 60 */ |
170 | /* CmdTimeout */ HZ, /* how long a close command may take */ | 170 | /* MaxXpCps */ 2000, |
171 | /* highest Xprint speed */ | ||
172 | /* MinXpCps */ 10, | ||
173 | /* slowest Xprint speed */ | ||
174 | /* SpinCmds */ 1, | ||
175 | /* non-zero for mega fast boots */ | ||
176 | /* First Addr */ 0x0A0000, | ||
177 | /* First address to look at */ | ||
178 | /* Last Addr */ 0xFF0000, | ||
179 | /* Last address looked at */ | ||
180 | /* BufferSize */ 1024, | ||
181 | /* Bytes per port of buffering */ | ||
182 | /* LowWater */ 256, | ||
183 | /* how much data left before wakeup */ | ||
184 | /* LineLength */ 80, | ||
185 | /* how wide is the console? */ | ||
186 | /* CmdTimeout */ HZ, | ||
187 | /* how long a close command may take */ | ||
171 | }; | 188 | }; |
172 | 189 | ||
173 | 190 | ||
@@ -175,21 +192,20 @@ RIOConf = | |||
175 | 192 | ||
176 | /* Function prototypes */ | 193 | /* Function prototypes */ |
177 | 194 | ||
178 | static void rio_disable_tx_interrupts (void * ptr); | 195 | static void rio_disable_tx_interrupts(void *ptr); |
179 | static void rio_enable_tx_interrupts (void * ptr); | 196 | static void rio_enable_tx_interrupts(void *ptr); |
180 | static void rio_disable_rx_interrupts (void * ptr); | 197 | static void rio_disable_rx_interrupts(void *ptr); |
181 | static void rio_enable_rx_interrupts (void * ptr); | 198 | static void rio_enable_rx_interrupts(void *ptr); |
182 | static int rio_get_CD (void * ptr); | 199 | static int rio_get_CD(void *ptr); |
183 | static void rio_shutdown_port (void * ptr); | 200 | static void rio_shutdown_port(void *ptr); |
184 | static int rio_set_real_termios (void *ptr); | 201 | static int rio_set_real_termios(void *ptr); |
185 | static void rio_hungup (void *ptr); | 202 | static void rio_hungup(void *ptr); |
186 | static void rio_close (void *ptr); | 203 | static void rio_close(void *ptr); |
187 | static int rio_chars_in_buffer (void * ptr); | 204 | static int rio_chars_in_buffer(void *ptr); |
188 | static int rio_fw_ioctl (struct inode *inode, struct file *filp, | 205 | static int rio_fw_ioctl(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg); |
189 | unsigned int cmd, unsigned long arg); | ||
190 | static int rio_init_drivers(void); | 206 | static int rio_init_drivers(void); |
191 | 207 | ||
192 | static void my_hd (void *addr, int len); | 208 | static void my_hd(void *addr, int len); |
193 | 209 | ||
194 | static struct tty_driver *rio_driver, *rio_driver2; | 210 | static struct tty_driver *rio_driver, *rio_driver2; |
195 | 211 | ||
@@ -209,7 +225,7 @@ static int rio_poll = 1; | |||
209 | 225 | ||
210 | /* These are the only open spaces in my computer. Yours may have more | 226 | /* These are the only open spaces in my computer. Yours may have more |
211 | or less.... */ | 227 | or less.... */ |
212 | static int rio_probe_addrs[]= {0xc0000, 0xd0000, 0xe0000}; | 228 | static int rio_probe_addrs[] = { 0xc0000, 0xd0000, 0xe0000 }; |
213 | 229 | ||
214 | #define NR_RIO_ADDRS ARRAY_SIZE(rio_probe_addrs) | 230 | #define NR_RIO_ADDRS ARRAY_SIZE(rio_probe_addrs) |
215 | 231 | ||
@@ -227,17 +243,17 @@ module_param(rio_debug, int, 0644); | |||
227 | module_param(rio_irqmask, long, 0); | 243 | module_param(rio_irqmask, long, 0); |
228 | 244 | ||
229 | static struct real_driver rio_real_driver = { | 245 | static struct real_driver rio_real_driver = { |
230 | rio_disable_tx_interrupts, | 246 | rio_disable_tx_interrupts, |
231 | rio_enable_tx_interrupts, | 247 | rio_enable_tx_interrupts, |
232 | rio_disable_rx_interrupts, | 248 | rio_disable_rx_interrupts, |
233 | rio_enable_rx_interrupts, | 249 | rio_enable_rx_interrupts, |
234 | rio_get_CD, | 250 | rio_get_CD, |
235 | rio_shutdown_port, | 251 | rio_shutdown_port, |
236 | rio_set_real_termios, | 252 | rio_set_real_termios, |
237 | rio_chars_in_buffer, | 253 | rio_chars_in_buffer, |
238 | rio_close, | 254 | rio_close, |
239 | rio_hungup, | 255 | rio_hungup, |
240 | NULL | 256 | NULL |
241 | }; | 257 | }; |
242 | 258 | ||
243 | /* | 259 | /* |
@@ -246,8 +262,8 @@ static struct real_driver rio_real_driver = { | |||
246 | */ | 262 | */ |
247 | 263 | ||
248 | static struct file_operations rio_fw_fops = { | 264 | static struct file_operations rio_fw_fops = { |
249 | .owner = THIS_MODULE, | 265 | .owner = THIS_MODULE, |
250 | .ioctl = rio_fw_ioctl, | 266 | .ioctl = rio_fw_ioctl, |
251 | }; | 267 | }; |
252 | 268 | ||
253 | static struct miscdevice rio_fw_device = { | 269 | static struct miscdevice rio_fw_device = { |
@@ -262,25 +278,22 @@ static struct miscdevice rio_fw_device = { | |||
262 | 278 | ||
263 | /* This doesn't work. Who's paranoid around here? Not me! */ | 279 | /* This doesn't work. Who's paranoid around here? Not me! */ |
264 | 280 | ||
265 | static inline int rio_paranoia_check(struct rio_port const * port, | 281 | static inline int rio_paranoia_check(struct rio_port const *port, char *name, const char *routine) |
266 | char *name, const char *routine) | ||
267 | { | 282 | { |
268 | 283 | ||
269 | static const char *badmagic = | 284 | static const char *badmagic = KERN_ERR "rio: Warning: bad rio port magic number for device %s in %s\n"; |
270 | KERN_ERR "rio: Warning: bad rio port magic number for device %s in %s\n"; | 285 | static const char *badinfo = KERN_ERR "rio: Warning: null rio port for device %s in %s\n"; |
271 | static const char *badinfo = | 286 | |
272 | KERN_ERR "rio: Warning: null rio port for device %s in %s\n"; | 287 | if (!port) { |
273 | 288 | printk(badinfo, name, routine); | |
274 | if (!port) { | 289 | return 1; |
275 | printk (badinfo, name, routine); | 290 | } |
276 | return 1; | 291 | if (port->magic != RIO_MAGIC) { |
277 | } | 292 | printk(badmagic, name, routine); |
278 | if (port->magic != RIO_MAGIC) { | 293 | return 1; |
279 | printk (badmagic, name, routine); | 294 | } |
280 | return 1; | 295 | |
281 | } | 296 | return 0; |
282 | |||
283 | return 0; | ||
284 | } | 297 | } |
285 | #else | 298 | #else |
286 | #define rio_paranoia_check(a,b,c) 0 | 299 | #define rio_paranoia_check(a,b,c) 0 |
@@ -288,53 +301,53 @@ static inline int rio_paranoia_check(struct rio_port const * port, | |||
288 | 301 | ||
289 | 302 | ||
290 | #ifdef DEBUG | 303 | #ifdef DEBUG |
291 | static void my_hd (void *ad, int len) | 304 | static void my_hd(void *ad, int len) |
292 | { | 305 | { |
293 | int i, j, ch; | 306 | int i, j, ch; |
294 | unsigned char *addr = ad; | 307 | unsigned char *addr = ad; |
295 | 308 | ||
296 | for (i=0;i<len;i+=16) { | 309 | for (i = 0; i < len; i += 16) { |
297 | rio_dprintk (RIO_DEBUG_PARAM, "%08x ", (int) addr+i); | 310 | rio_dprintk(RIO_DEBUG_PARAM, "%08x ", (int) addr + i); |
298 | for (j=0;j<16;j++) { | 311 | for (j = 0; j < 16; j++) { |
299 | rio_dprintk (RIO_DEBUG_PARAM, "%02x %s", addr[j+i], (j==7)?" ":""); | 312 | rio_dprintk(RIO_DEBUG_PARAM, "%02x %s", addr[j + i], (j == 7) ? " " : ""); |
300 | } | 313 | } |
301 | for (j=0;j<16;j++) { | 314 | for (j = 0; j < 16; j++) { |
302 | ch = addr[j+i]; | 315 | ch = addr[j + i]; |
303 | rio_dprintk (RIO_DEBUG_PARAM, "%c", (ch < 0x20)?'.':((ch > 0x7f)?'.':ch)); | 316 | rio_dprintk(RIO_DEBUG_PARAM, "%c", (ch < 0x20) ? '.' : ((ch > 0x7f) ? '.' : ch)); |
304 | } | 317 | } |
305 | rio_dprintk (RIO_DEBUG_PARAM, "\n"); | 318 | rio_dprintk(RIO_DEBUG_PARAM, "\n"); |
306 | } | 319 | } |
307 | } | 320 | } |
308 | #else | 321 | #else |
309 | #define my_hd(ad,len) do{/* nothing*/ } while (0) | 322 | #define my_hd(ad,len) do{/* nothing*/ } while (0) |
310 | #endif | 323 | #endif |
311 | 324 | ||
312 | 325 | ||
313 | /* Delay a number of jiffies, allowing a signal to interrupt */ | 326 | /* Delay a number of jiffies, allowing a signal to interrupt */ |
314 | int RIODelay (struct Port *PortP, int njiffies) | 327 | int RIODelay(struct Port *PortP, int njiffies) |
315 | { | 328 | { |
316 | func_enter (); | 329 | func_enter(); |
317 | 330 | ||
318 | rio_dprintk (RIO_DEBUG_DELAY, "delaying %d jiffies\n", njiffies); | 331 | rio_dprintk(RIO_DEBUG_DELAY, "delaying %d jiffies\n", njiffies); |
319 | msleep_interruptible(jiffies_to_msecs(njiffies)); | 332 | msleep_interruptible(jiffies_to_msecs(njiffies)); |
320 | func_exit(); | 333 | func_exit(); |
321 | 334 | ||
322 | if (signal_pending(current)) | 335 | if (signal_pending(current)) |
323 | return RIO_FAIL; | 336 | return RIO_FAIL; |
324 | else | 337 | else |
325 | return !RIO_FAIL; | 338 | return !RIO_FAIL; |
326 | } | 339 | } |
327 | 340 | ||
328 | 341 | ||
329 | /* Delay a number of jiffies, disallowing a signal to interrupt */ | 342 | /* Delay a number of jiffies, disallowing a signal to interrupt */ |
330 | int RIODelay_ni (struct Port *PortP, int njiffies) | 343 | int RIODelay_ni(struct Port *PortP, int njiffies) |
331 | { | 344 | { |
332 | func_enter (); | 345 | func_enter(); |
333 | 346 | ||
334 | rio_dprintk (RIO_DEBUG_DELAY, "delaying %d jiffies (ni)\n", njiffies); | 347 | rio_dprintk(RIO_DEBUG_DELAY, "delaying %d jiffies (ni)\n", njiffies); |
335 | msleep(jiffies_to_msecs(njiffies)); | 348 | msleep(jiffies_to_msecs(njiffies)); |
336 | func_exit(); | 349 | func_exit(); |
337 | return !RIO_FAIL; | 350 | return !RIO_FAIL; |
338 | } | 351 | } |
339 | 352 | ||
340 | 353 | ||
@@ -350,126 +363,121 @@ int rio_ismodem(struct tty_struct *tty) | |||
350 | } | 363 | } |
351 | 364 | ||
352 | 365 | ||
353 | static int rio_set_real_termios (void *ptr) | 366 | static int rio_set_real_termios(void *ptr) |
354 | { | 367 | { |
355 | int rv, modem; | 368 | int rv, modem; |
356 | struct tty_struct *tty; | 369 | struct tty_struct *tty; |
357 | func_enter(); | 370 | func_enter(); |
358 | 371 | ||
359 | tty = ((struct Port *)ptr)->gs.tty; | 372 | tty = ((struct Port *) ptr)->gs.tty; |
360 | 373 | ||
361 | modem = rio_ismodem(tty); | 374 | modem = rio_ismodem(tty); |
362 | 375 | ||
363 | rv = RIOParam( (struct Port *) ptr, CONFIG, modem, 1); | 376 | rv = RIOParam((struct Port *) ptr, CONFIG, modem, 1); |
364 | 377 | ||
365 | func_exit (); | 378 | func_exit(); |
366 | 379 | ||
367 | return rv; | 380 | return rv; |
368 | } | 381 | } |
369 | 382 | ||
370 | 383 | ||
371 | static void rio_reset_interrupt (struct Host *HostP) | 384 | static void rio_reset_interrupt(struct Host *HostP) |
372 | { | 385 | { |
373 | func_enter(); | 386 | func_enter(); |
374 | 387 | ||
375 | switch( HostP->Type ) { | 388 | switch (HostP->Type) { |
376 | case RIO_AT: | 389 | case RIO_AT: |
377 | case RIO_MCA: | 390 | case RIO_MCA: |
378 | case RIO_PCI: | 391 | case RIO_PCI: |
379 | WBYTE(HostP->ResetInt , 0xff); | 392 | WBYTE(HostP->ResetInt, 0xff); |
380 | } | 393 | } |
381 | 394 | ||
382 | func_exit(); | 395 | func_exit(); |
383 | } | 396 | } |
384 | 397 | ||
385 | 398 | ||
386 | static irqreturn_t rio_interrupt (int irq, void *ptr, struct pt_regs *regs) | 399 | static irqreturn_t rio_interrupt(int irq, void *ptr, struct pt_regs *regs) |
387 | { | 400 | { |
388 | struct Host *HostP; | 401 | struct Host *HostP; |
389 | func_enter (); | 402 | func_enter(); |
390 | 403 | ||
391 | HostP = (struct Host*)ptr; /* &p->RIOHosts[(long)ptr]; */ | 404 | HostP = (struct Host *) ptr; /* &p->RIOHosts[(long)ptr]; */ |
392 | rio_dprintk (RIO_DEBUG_IFLOW, "rio: enter rio_interrupt (%d/%d)\n", | 405 | rio_dprintk(RIO_DEBUG_IFLOW, "rio: enter rio_interrupt (%d/%d)\n", irq, HostP->Ivec); |
393 | irq, HostP->Ivec); | ||
394 | 406 | ||
395 | /* AAargh! The order in which to do these things is essential and | 407 | /* AAargh! The order in which to do these things is essential and |
396 | not trivial. | 408 | not trivial. |
397 | |||
398 | - Rate limit goes before "recursive". Otherwise a series of | ||
399 | recursive calls will hang the machine in the interrupt routine. | ||
400 | 409 | ||
401 | - hardware twiddling goes before "recursive". Otherwise when we | 410 | - Rate limit goes before "recursive". Otherwise a series of |
402 | poll the card, and a recursive interrupt happens, we won't | 411 | recursive calls will hang the machine in the interrupt routine. |
403 | ack the card, so it might keep on interrupting us. (especially | ||
404 | level sensitive interrupt systems like PCI). | ||
405 | 412 | ||
406 | - Rate limit goes before hardware twiddling. Otherwise we won't | 413 | - hardware twiddling goes before "recursive". Otherwise when we |
407 | catch a card that has gone bonkers. | 414 | poll the card, and a recursive interrupt happens, we won't |
415 | ack the card, so it might keep on interrupting us. (especially | ||
416 | level sensitive interrupt systems like PCI). | ||
408 | 417 | ||
409 | - The "initialized" test goes after the hardware twiddling. Otherwise | 418 | - Rate limit goes before hardware twiddling. Otherwise we won't |
410 | the card will stick us in the interrupt routine again. | 419 | catch a card that has gone bonkers. |
411 | 420 | ||
412 | - The initialized test goes before recursive. | 421 | - The "initialized" test goes after the hardware twiddling. Otherwise |
413 | */ | 422 | the card will stick us in the interrupt routine again. |
423 | |||
424 | - The initialized test goes before recursive. | ||
425 | */ | ||
414 | 426 | ||
415 | 427 | ||
416 | 428 | ||
417 | #ifdef IRQ_RATE_LIMIT | 429 | #ifdef IRQ_RATE_LIMIT |
418 | /* Aaargh! I'm ashamed. This costs more lines-of-code than the | 430 | /* Aaargh! I'm ashamed. This costs more lines-of-code than the |
419 | actual interrupt routine!. (Well, used to when I wrote that comment) */ | 431 | actual interrupt routine!. (Well, used to when I wrote that comment) */ |
420 | { | 432 | { |
421 | static int lastjif; | 433 | static int lastjif; |
422 | static int nintr=0; | 434 | static int nintr = 0; |
423 | 435 | ||
424 | if (lastjif == jiffies) { | 436 | if (lastjif == jiffies) { |
425 | if (++nintr > IRQ_RATE_LIMIT) { | 437 | if (++nintr > IRQ_RATE_LIMIT) { |
426 | free_irq (HostP->Ivec, ptr); | 438 | free_irq(HostP->Ivec, ptr); |
427 | printk (KERN_ERR "rio: Too many interrupts. Turning off interrupt %d.\n", | 439 | printk(KERN_ERR "rio: Too many interrupts. Turning off interrupt %d.\n", HostP->Ivec); |
428 | HostP->Ivec); | 440 | } |
429 | } | 441 | } else { |
430 | } else { | 442 | lastjif = jiffies; |
431 | lastjif = jiffies; | 443 | nintr = 0; |
432 | nintr = 0; | 444 | } |
433 | } | 445 | } |
434 | } | ||
435 | #endif | 446 | #endif |
436 | rio_dprintk (RIO_DEBUG_IFLOW, "rio: We've have noticed the interrupt\n"); | 447 | rio_dprintk(RIO_DEBUG_IFLOW, "rio: We've have noticed the interrupt\n"); |
437 | if (HostP->Ivec == irq) { | 448 | if (HostP->Ivec == irq) { |
438 | /* Tell the card we've noticed the interrupt. */ | 449 | /* Tell the card we've noticed the interrupt. */ |
439 | rio_reset_interrupt (HostP); | 450 | rio_reset_interrupt(HostP); |
440 | } | 451 | } |
441 | 452 | ||
442 | if ((HostP->Flags & RUN_STATE) != RC_RUNNING) | 453 | if ((HostP->Flags & RUN_STATE) != RC_RUNNING) |
443 | return IRQ_HANDLED; | 454 | return IRQ_HANDLED; |
444 | 455 | ||
445 | if (test_and_set_bit (RIO_BOARD_INTR_LOCK, &HostP->locks)) { | 456 | if (test_and_set_bit(RIO_BOARD_INTR_LOCK, &HostP->locks)) { |
446 | printk (KERN_ERR "Recursive interrupt! (host %d/irq%d)\n", | 457 | printk(KERN_ERR "Recursive interrupt! (host %d/irq%d)\n", (int) ptr, HostP->Ivec); |
447 | (int) ptr, HostP->Ivec); | 458 | return IRQ_HANDLED; |
448 | return IRQ_HANDLED; | 459 | } |
449 | } | 460 | |
450 | 461 | RIOServiceHost(p, HostP, irq); | |
451 | RIOServiceHost(p, HostP, irq); | 462 | |
452 | 463 | rio_dprintk(RIO_DEBUG_IFLOW, "riointr() doing host %d type %d\n", (int) ptr, HostP->Type); | |
453 | rio_dprintk ( RIO_DEBUG_IFLOW, "riointr() doing host %d type %d\n", | 464 | |
454 | (int) ptr, HostP->Type); | 465 | clear_bit(RIO_BOARD_INTR_LOCK, &HostP->locks); |
455 | 466 | rio_dprintk(RIO_DEBUG_IFLOW, "rio: exit rio_interrupt (%d/%d)\n", irq, HostP->Ivec); | |
456 | clear_bit (RIO_BOARD_INTR_LOCK, &HostP->locks); | 467 | func_exit(); |
457 | rio_dprintk (RIO_DEBUG_IFLOW, "rio: exit rio_interrupt (%d/%d)\n", | 468 | return IRQ_HANDLED; |
458 | irq, HostP->Ivec); | ||
459 | func_exit (); | ||
460 | return IRQ_HANDLED; | ||
461 | } | 469 | } |
462 | 470 | ||
463 | 471 | ||
464 | static void rio_pollfunc (unsigned long data) | 472 | static void rio_pollfunc(unsigned long data) |
465 | { | 473 | { |
466 | func_enter (); | 474 | func_enter(); |
467 | 475 | ||
468 | rio_interrupt (0, &p->RIOHosts[data], NULL); | 476 | rio_interrupt(0, &p->RIOHosts[data], NULL); |
469 | p->RIOHosts[data].timer.expires = jiffies + rio_poll; | 477 | p->RIOHosts[data].timer.expires = jiffies + rio_poll; |
470 | add_timer (&p->RIOHosts[data].timer); | 478 | add_timer(&p->RIOHosts[data].timer); |
471 | 479 | ||
472 | func_exit (); | 480 | func_exit(); |
473 | } | 481 | } |
474 | 482 | ||
475 | 483 | ||
@@ -481,106 +489,106 @@ static void rio_pollfunc (unsigned long data) | |||
481 | /* Ehhm. I don't know how to fiddle with interrupts on the Specialix | 489 | /* Ehhm. I don't know how to fiddle with interrupts on the Specialix |
482 | cards. .... Hmm. Ok I figured it out. You don't. -- REW */ | 490 | cards. .... Hmm. Ok I figured it out. You don't. -- REW */ |
483 | 491 | ||
484 | static void rio_disable_tx_interrupts (void * ptr) | 492 | static void rio_disable_tx_interrupts(void *ptr) |
485 | { | 493 | { |
486 | func_enter(); | 494 | func_enter(); |
487 | 495 | ||
488 | /* port->gs.flags &= ~GS_TX_INTEN; */ | 496 | /* port->gs.flags &= ~GS_TX_INTEN; */ |
489 | 497 | ||
490 | func_exit(); | 498 | func_exit(); |
491 | } | 499 | } |
492 | 500 | ||
493 | 501 | ||
494 | static void rio_enable_tx_interrupts (void * ptr) | 502 | static void rio_enable_tx_interrupts(void *ptr) |
495 | { | 503 | { |
496 | struct Port *PortP = ptr; | 504 | struct Port *PortP = ptr; |
497 | /* int hn; */ | 505 | /* int hn; */ |
498 | 506 | ||
499 | func_enter(); | 507 | func_enter(); |
500 | 508 | ||
501 | /* hn = PortP->HostP - p->RIOHosts; | 509 | /* hn = PortP->HostP - p->RIOHosts; |
502 | 510 | ||
503 | rio_dprintk (RIO_DEBUG_TTY, "Pushing host %d\n", hn); | 511 | rio_dprintk (RIO_DEBUG_TTY, "Pushing host %d\n", hn); |
504 | rio_interrupt (-1,(void *) hn, NULL); */ | 512 | rio_interrupt (-1,(void *) hn, NULL); */ |
505 | 513 | ||
506 | RIOTxEnable((char *) PortP); | 514 | RIOTxEnable((char *) PortP); |
507 | 515 | ||
508 | /* | 516 | /* |
509 | * In general we cannot count on "tx empty" interrupts, although | 517 | * In general we cannot count on "tx empty" interrupts, although |
510 | * the interrupt routine seems to be able to tell the difference. | 518 | * the interrupt routine seems to be able to tell the difference. |
511 | */ | 519 | */ |
512 | PortP->gs.flags &= ~GS_TX_INTEN; | 520 | PortP->gs.flags &= ~GS_TX_INTEN; |
513 | 521 | ||
514 | func_exit(); | 522 | func_exit(); |
515 | } | 523 | } |
516 | 524 | ||
517 | 525 | ||
518 | static void rio_disable_rx_interrupts (void * ptr) | 526 | static void rio_disable_rx_interrupts(void *ptr) |
519 | { | 527 | { |
520 | func_enter(); | 528 | func_enter(); |
521 | func_exit(); | 529 | func_exit(); |
522 | } | 530 | } |
523 | 531 | ||
524 | static void rio_enable_rx_interrupts (void * ptr) | 532 | static void rio_enable_rx_interrupts(void *ptr) |
525 | { | 533 | { |
526 | /* struct rio_port *port = ptr; */ | 534 | /* struct rio_port *port = ptr; */ |
527 | func_enter(); | 535 | func_enter(); |
528 | func_exit(); | 536 | func_exit(); |
529 | } | 537 | } |
530 | 538 | ||
531 | 539 | ||
532 | /* Jeez. Isn't this simple? */ | 540 | /* Jeez. Isn't this simple? */ |
533 | static int rio_get_CD (void * ptr) | 541 | static int rio_get_CD(void *ptr) |
534 | { | 542 | { |
535 | struct Port *PortP = ptr; | 543 | struct Port *PortP = ptr; |
536 | int rv; | 544 | int rv; |
545 | |||
546 | func_enter(); | ||
547 | rv = (PortP->ModemState & MSVR1_CD) != 0; | ||
537 | 548 | ||
538 | func_enter(); | 549 | rio_dprintk(RIO_DEBUG_INIT, "Getting CD status: %d\n", rv); |
539 | rv = (PortP->ModemState & MSVR1_CD) != 0; | ||
540 | 550 | ||
541 | rio_dprintk (RIO_DEBUG_INIT, "Getting CD status: %d\n", rv); | 551 | func_exit(); |
542 | 552 | return rv; | |
543 | func_exit(); | ||
544 | return rv; | ||
545 | } | 553 | } |
546 | 554 | ||
547 | 555 | ||
548 | /* Jeez. Isn't this simple? Actually, we can sync with the actual port | 556 | /* Jeez. Isn't this simple? Actually, we can sync with the actual port |
549 | by just pushing stuff into the queue going to the port... */ | 557 | by just pushing stuff into the queue going to the port... */ |
550 | static int rio_chars_in_buffer (void * ptr) | 558 | static int rio_chars_in_buffer(void *ptr) |
551 | { | 559 | { |
552 | func_enter(); | 560 | func_enter(); |
553 | 561 | ||
554 | func_exit(); | 562 | func_exit(); |
555 | return 0; | 563 | return 0; |
556 | } | 564 | } |
557 | 565 | ||
558 | 566 | ||
559 | /* Nothing special here... */ | 567 | /* Nothing special here... */ |
560 | static void rio_shutdown_port (void * ptr) | 568 | static void rio_shutdown_port(void *ptr) |
561 | { | 569 | { |
562 | struct Port *PortP; | 570 | struct Port *PortP; |
563 | 571 | ||
564 | func_enter(); | 572 | func_enter(); |
565 | 573 | ||
566 | PortP = (struct Port *)ptr; | 574 | PortP = (struct Port *) ptr; |
567 | PortP->gs.tty = NULL; | 575 | PortP->gs.tty = NULL; |
568 | #if 0 | 576 | #if 0 |
569 | port->gs.flags &= ~ GS_ACTIVE; | 577 | port->gs.flags &= ~GS_ACTIVE; |
570 | if (!port->gs.tty) { | 578 | if (!port->gs.tty) { |
571 | rio_dprintk (RIO_DBUG_TTY, "No tty.\n"); | 579 | rio_dprintk(RIO_DBUG_TTY, "No tty.\n"); |
572 | return; | 580 | return; |
573 | } | 581 | } |
574 | if (!port->gs.tty->termios) { | 582 | if (!port->gs.tty->termios) { |
575 | rio_dprintk (RIO_DEBUG_TTY, "No termios.\n"); | 583 | rio_dprintk(RIO_DEBUG_TTY, "No termios.\n"); |
576 | return; | 584 | return; |
577 | } | 585 | } |
578 | if (port->gs.tty->termios->c_cflag & HUPCL) { | 586 | if (port->gs.tty->termios->c_cflag & HUPCL) { |
579 | rio_setsignals (port, 0, 0); | 587 | rio_setsignals(port, 0, 0); |
580 | } | 588 | } |
581 | #endif | 589 | #endif |
582 | 590 | ||
583 | func_exit(); | 591 | func_exit(); |
584 | } | 592 | } |
585 | 593 | ||
586 | 594 | ||
@@ -591,16 +599,16 @@ static void rio_shutdown_port (void * ptr) | |||
591 | running minicom on a serial port that is driven by a modularized | 599 | running minicom on a serial port that is driven by a modularized |
592 | driver. Have the modem hangup. Then remove the driver module. Then | 600 | driver. Have the modem hangup. Then remove the driver module. Then |
593 | exit minicom. I expect an "oops". -- REW */ | 601 | exit minicom. I expect an "oops". -- REW */ |
594 | static void rio_hungup (void *ptr) | 602 | static void rio_hungup(void *ptr) |
595 | { | 603 | { |
596 | struct Port *PortP; | 604 | struct Port *PortP; |
605 | |||
606 | func_enter(); | ||
597 | 607 | ||
598 | func_enter(); | 608 | PortP = (struct Port *) ptr; |
599 | 609 | PortP->gs.tty = NULL; | |
600 | PortP = (struct Port *)ptr; | ||
601 | PortP->gs.tty = NULL; | ||
602 | 610 | ||
603 | func_exit (); | 611 | func_exit(); |
604 | } | 612 | } |
605 | 613 | ||
606 | 614 | ||
@@ -608,146 +616,135 @@ static void rio_hungup (void *ptr) | |||
608 | this. | 616 | this. |
609 | rs_close (...){save_flags;cli;real_close();dec_use_count;restore_flags;} | 617 | rs_close (...){save_flags;cli;real_close();dec_use_count;restore_flags;} |
610 | */ | 618 | */ |
611 | static void rio_close (void *ptr) | 619 | static void rio_close(void *ptr) |
612 | { | 620 | { |
613 | struct Port *PortP; | 621 | struct Port *PortP; |
614 | 622 | ||
615 | func_enter (); | 623 | func_enter(); |
616 | 624 | ||
617 | PortP = (struct Port *)ptr; | 625 | PortP = (struct Port *) ptr; |
618 | 626 | ||
619 | riotclose (ptr); | 627 | riotclose(ptr); |
620 | 628 | ||
621 | if(PortP->gs.count) { | 629 | if (PortP->gs.count) { |
622 | printk (KERN_ERR "WARNING port count:%d\n", PortP->gs.count); | 630 | printk(KERN_ERR "WARNING port count:%d\n", PortP->gs.count); |
623 | PortP->gs.count = 0; | 631 | PortP->gs.count = 0; |
624 | } | 632 | } |
625 | 633 | ||
626 | PortP->gs.tty = NULL; | 634 | PortP->gs.tty = NULL; |
627 | func_exit (); | 635 | func_exit(); |
628 | } | 636 | } |
629 | 637 | ||
630 | 638 | ||
631 | 639 | ||
632 | static int rio_fw_ioctl (struct inode *inode, struct file *filp, | 640 | static int rio_fw_ioctl(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg) |
633 | unsigned int cmd, unsigned long arg) | ||
634 | { | 641 | { |
635 | int rc = 0; | 642 | int rc = 0; |
636 | func_enter(); | 643 | func_enter(); |
637 | 644 | ||
638 | /* The "dev" argument isn't used. */ | 645 | /* The "dev" argument isn't used. */ |
639 | rc = riocontrol (p, 0, cmd, (void *)arg, capable(CAP_SYS_ADMIN)); | 646 | rc = riocontrol(p, 0, cmd, (void *) arg, capable(CAP_SYS_ADMIN)); |
640 | 647 | ||
641 | func_exit (); | 648 | func_exit(); |
642 | return rc; | 649 | return rc; |
643 | } | 650 | } |
644 | 651 | ||
645 | extern int RIOShortCommand(struct rio_info *p, struct Port *PortP, | 652 | extern int RIOShortCommand(struct rio_info *p, struct Port *PortP, int command, int len, int arg); |
646 | int command, int len, int arg); | ||
647 | 653 | ||
648 | static int rio_ioctl (struct tty_struct * tty, struct file * filp, | 654 | static int rio_ioctl(struct tty_struct *tty, struct file *filp, unsigned int cmd, unsigned long arg) |
649 | unsigned int cmd, unsigned long arg) | ||
650 | { | 655 | { |
651 | int rc; | 656 | int rc; |
652 | struct Port *PortP; | 657 | struct Port *PortP; |
653 | int ival; | 658 | int ival; |
654 | 659 | ||
655 | func_enter(); | 660 | func_enter(); |
656 | 661 | ||
657 | PortP = (struct Port *)tty->driver_data; | 662 | PortP = (struct Port *) tty->driver_data; |
658 | 663 | ||
659 | rc = 0; | 664 | rc = 0; |
660 | switch (cmd) { | 665 | switch (cmd) { |
661 | #if 0 | 666 | #if 0 |
662 | case TIOCGSOFTCAR: | 667 | case TIOCGSOFTCAR: |
663 | rc = put_user(((tty->termios->c_cflag & CLOCAL) ? 1 : 0), | 668 | rc = put_user(((tty->termios->c_cflag & CLOCAL) ? 1 : 0), (unsigned int *) arg); |
664 | (unsigned int *) arg); | 669 | break; |
665 | break; | ||
666 | #endif | 670 | #endif |
667 | case TIOCSSOFTCAR: | 671 | case TIOCSSOFTCAR: |
668 | if ((rc = get_user(ival, (unsigned int *) arg)) == 0) { | 672 | if ((rc = get_user(ival, (unsigned int *) arg)) == 0) { |
669 | tty->termios->c_cflag = | 673 | tty->termios->c_cflag = (tty->termios->c_cflag & ~CLOCAL) | (ival ? CLOCAL : 0); |
670 | (tty->termios->c_cflag & ~CLOCAL) | | 674 | } |
671 | (ival ? CLOCAL : 0); | 675 | break; |
672 | } | 676 | case TIOCGSERIAL: |
673 | break; | 677 | rc = -EFAULT; |
674 | case TIOCGSERIAL: | 678 | if (access_ok(VERIFY_WRITE, (void *) arg, sizeof(struct serial_struct))) |
675 | rc = -EFAULT; | 679 | rc = gs_getserial(&PortP->gs, (struct serial_struct *) arg); |
676 | if (access_ok(VERIFY_WRITE, (void *) arg, | 680 | break; |
677 | sizeof(struct serial_struct))) | 681 | case TCSBRK: |
678 | rc = gs_getserial(&PortP->gs, (struct serial_struct *) arg); | 682 | if (PortP->State & RIO_DELETED) { |
679 | break; | 683 | rio_dprintk(RIO_DEBUG_TTY, "BREAK on deleted RTA\n"); |
680 | case TCSBRK: | 684 | rc = -EIO; |
681 | if ( PortP->State & RIO_DELETED ) { | 685 | } else { |
682 | rio_dprintk (RIO_DEBUG_TTY, "BREAK on deleted RTA\n"); | 686 | if (RIOShortCommand(p, PortP, SBREAK, 2, 250) == RIO_FAIL) { |
683 | rc = -EIO; | 687 | rio_dprintk(RIO_DEBUG_INTR, "SBREAK RIOShortCommand failed\n"); |
684 | } else { | 688 | rc = -EIO; |
685 | if (RIOShortCommand(p, PortP, SBREAK, 2, 250) == RIO_FAIL) { | 689 | } |
686 | rio_dprintk (RIO_DEBUG_INTR, "SBREAK RIOShortCommand failed\n"); | 690 | } |
687 | rc = -EIO; | 691 | break; |
688 | } | 692 | case TCSBRKP: |
689 | } | 693 | if (PortP->State & RIO_DELETED) { |
690 | break; | 694 | rio_dprintk(RIO_DEBUG_TTY, "BREAK on deleted RTA\n"); |
691 | case TCSBRKP: | 695 | rc = -EIO; |
692 | if ( PortP->State & RIO_DELETED ) { | 696 | } else { |
693 | rio_dprintk (RIO_DEBUG_TTY, "BREAK on deleted RTA\n"); | 697 | int l; |
694 | rc = -EIO; | 698 | l = arg ? arg * 100 : 250; |
695 | } else { | 699 | if (l > 255) |
696 | int l; | 700 | l = 255; |
697 | l = arg?arg*100:250; | 701 | if (RIOShortCommand(p, PortP, SBREAK, 2, arg ? arg * 100 : 250) == RIO_FAIL) { |
698 | if (l > 255) l = 255; | 702 | rio_dprintk(RIO_DEBUG_INTR, "SBREAK RIOShortCommand failed\n"); |
699 | if (RIOShortCommand(p, PortP, SBREAK, 2, arg?arg*100:250) == RIO_FAIL) { | 703 | rc = -EIO; |
700 | rio_dprintk (RIO_DEBUG_INTR, "SBREAK RIOShortCommand failed\n"); | 704 | } |
701 | rc = -EIO; | 705 | } |
702 | } | 706 | break; |
703 | } | 707 | case TIOCSSERIAL: |
704 | break; | 708 | rc = -EFAULT; |
705 | case TIOCSSERIAL: | 709 | if (access_ok(VERIFY_READ, (void *) arg, sizeof(struct serial_struct))) |
706 | rc = -EFAULT; | 710 | rc = gs_setserial(&PortP->gs, (struct serial_struct *) arg); |
707 | if (access_ok(VERIFY_READ, (void *) arg, | 711 | break; |
708 | sizeof(struct serial_struct))) | ||
709 | rc = gs_setserial(&PortP->gs, (struct serial_struct *) arg); | ||
710 | break; | ||
711 | #if 0 | 712 | #if 0 |
712 | /* | 713 | /* |
713 | * note: these IOCTLs no longer reach here. Use | 714 | * note: these IOCTLs no longer reach here. Use |
714 | * tiocmset/tiocmget driver methods instead. The | 715 | * tiocmset/tiocmget driver methods instead. The |
715 | * #if 0 disablement predates this comment. | 716 | * #if 0 disablement predates this comment. |
716 | */ | 717 | */ |
717 | case TIOCMGET: | 718 | case TIOCMGET: |
718 | rc = -EFAULT; | 719 | rc = -EFAULT; |
719 | if (access_ok(VERIFY_WRITE, (void *) arg, | 720 | if (access_ok(VERIFY_WRITE, (void *) arg, sizeof(unsigned int))) { |
720 | sizeof(unsigned int))) { | 721 | rc = 0; |
721 | rc = 0; | 722 | ival = rio_getsignals(port); |
722 | ival = rio_getsignals(port); | 723 | put_user(ival, (unsigned int *) arg); |
723 | put_user(ival, (unsigned int *) arg); | 724 | } |
724 | } | 725 | break; |
725 | break; | 726 | case TIOCMBIS: |
726 | case TIOCMBIS: | 727 | if ((rc = get_user(ival, (unsigned int *) arg)) == 0) { |
727 | if ((rc = get_user(ival, (unsigned int *) arg)) == 0) { | 728 | rio_setsignals(port, ((ival & TIOCM_DTR) ? 1 : -1), ((ival & TIOCM_RTS) ? 1 : -1)); |
728 | rio_setsignals(port, ((ival & TIOCM_DTR) ? 1 : -1), | 729 | } |
729 | ((ival & TIOCM_RTS) ? 1 : -1)); | 730 | break; |
730 | } | 731 | case TIOCMBIC: |
731 | break; | 732 | if ((rc = get_user(ival, (unsigned int *) arg)) == 0) { |
732 | case TIOCMBIC: | 733 | rio_setsignals(port, ((ival & TIOCM_DTR) ? 0 : -1), ((ival & TIOCM_RTS) ? 0 : -1)); |
733 | if ((rc = get_user(ival, (unsigned int *) arg)) == 0) { | 734 | } |
734 | rio_setsignals(port, ((ival & TIOCM_DTR) ? 0 : -1), | 735 | break; |
735 | ((ival & TIOCM_RTS) ? 0 : -1)); | 736 | case TIOCMSET: |
736 | } | 737 | if ((rc = get_user(ival, (unsigned int *) arg)) == 0) { |
737 | break; | 738 | rio_setsignals(port, ((ival & TIOCM_DTR) ? 1 : 0), ((ival & TIOCM_RTS) ? 1 : 0)); |
738 | case TIOCMSET: | 739 | } |
739 | if ((rc = get_user(ival, (unsigned int *) arg)) == 0) { | 740 | break; |
740 | rio_setsignals(port, ((ival & TIOCM_DTR) ? 1 : 0), | ||
741 | ((ival & TIOCM_RTS) ? 1 : 0)); | ||
742 | } | ||
743 | break; | ||
744 | #endif | 741 | #endif |
745 | default: | 742 | default: |
746 | rc = -ENOIOCTLCMD; | 743 | rc = -ENOIOCTLCMD; |
747 | break; | 744 | break; |
748 | } | 745 | } |
749 | func_exit(); | 746 | func_exit(); |
750 | return rc; | 747 | return rc; |
751 | } | 748 | } |
752 | 749 | ||
753 | 750 | ||
@@ -767,37 +764,37 @@ static int rio_ioctl (struct tty_struct * tty, struct file * filp, | |||
767 | * flow control scheme is in use for that port. -- Simon Allen | 764 | * flow control scheme is in use for that port. -- Simon Allen |
768 | */ | 765 | */ |
769 | 766 | ||
770 | static void rio_throttle (struct tty_struct * tty) | 767 | static void rio_throttle(struct tty_struct *tty) |
771 | { | 768 | { |
772 | struct Port *port = (struct Port *)tty->driver_data; | 769 | struct Port *port = (struct Port *) tty->driver_data; |
773 | 770 | ||
774 | func_enter(); | 771 | func_enter(); |
775 | /* If the port is using any type of input flow | 772 | /* If the port is using any type of input flow |
776 | * control then throttle the port. | 773 | * control then throttle the port. |
777 | */ | 774 | */ |
778 | 775 | ||
779 | if((tty->termios->c_cflag & CRTSCTS) || (I_IXOFF(tty)) ) { | 776 | if ((tty->termios->c_cflag & CRTSCTS) || (I_IXOFF(tty))) { |
780 | port->State |= RIO_THROTTLE_RX; | 777 | port->State |= RIO_THROTTLE_RX; |
781 | } | 778 | } |
782 | 779 | ||
783 | func_exit(); | 780 | func_exit(); |
784 | } | 781 | } |
785 | 782 | ||
786 | 783 | ||
787 | static void rio_unthrottle (struct tty_struct * tty) | 784 | static void rio_unthrottle(struct tty_struct *tty) |
788 | { | 785 | { |
789 | struct Port *port = (struct Port *)tty->driver_data; | 786 | struct Port *port = (struct Port *) tty->driver_data; |
790 | 787 | ||
791 | func_enter(); | 788 | func_enter(); |
792 | /* Always unthrottle even if flow control is not enabled on | 789 | /* Always unthrottle even if flow control is not enabled on |
793 | * this port in case we disabled flow control while the port | 790 | * this port in case we disabled flow control while the port |
794 | * was throttled | 791 | * was throttled |
795 | */ | 792 | */ |
796 | 793 | ||
797 | port->State &= ~RIO_THROTTLE_RX; | 794 | port->State &= ~RIO_THROTTLE_RX; |
798 | 795 | ||
799 | func_exit(); | 796 | func_exit(); |
800 | return; | 797 | return; |
801 | } | 798 | } |
802 | 799 | ||
803 | 800 | ||
@@ -809,35 +806,34 @@ static void rio_unthrottle (struct tty_struct * tty) | |||
809 | * ********************************************************************** */ | 806 | * ********************************************************************** */ |
810 | 807 | ||
811 | 808 | ||
812 | static struct vpd_prom *get_VPD_PROM (struct Host *hp) | 809 | static struct vpd_prom *get_VPD_PROM(struct Host *hp) |
813 | { | 810 | { |
814 | static struct vpd_prom vpdp; | 811 | static struct vpd_prom vpdp; |
815 | char *p; | 812 | char *p; |
816 | int i; | 813 | int i; |
814 | |||
815 | func_enter(); | ||
816 | rio_dprintk(RIO_DEBUG_PROBE, "Going to verify vpd prom at %p.\n", hp->Caddr + RIO_VPD_ROM); | ||
817 | 817 | ||
818 | func_enter(); | 818 | p = (char *) &vpdp; |
819 | rio_dprintk (RIO_DEBUG_PROBE, "Going to verify vpd prom at %p.\n", | 819 | for (i = 0; i < sizeof(struct vpd_prom); i++) |
820 | hp->Caddr + RIO_VPD_ROM); | 820 | *p++ = readb(hp->Caddr + RIO_VPD_ROM + i * 2); |
821 | /* read_rio_byte (hp, RIO_VPD_ROM + i*2); */ | ||
821 | 822 | ||
822 | p = (char *) &vpdp; | 823 | /* Terminate the identifier string. |
823 | for (i=0;i< sizeof (struct vpd_prom);i++) | 824 | *** requires one extra byte in struct vpd_prom *** */ |
824 | *p++ = readb (hp->Caddr+RIO_VPD_ROM + i*2); | 825 | *p++ = 0; |
825 | /* read_rio_byte (hp, RIO_VPD_ROM + i*2); */ | ||
826 | 826 | ||
827 | /* Terminate the identifier string. | 827 | if (rio_debug & RIO_DEBUG_PROBE) |
828 | *** requires one extra byte in struct vpd_prom *** */ | 828 | my_hd((char *) &vpdp, 0x20); |
829 | *p++=0; | ||
830 | 829 | ||
831 | if (rio_debug & RIO_DEBUG_PROBE) | 830 | func_exit(); |
832 | my_hd ((char *)&vpdp, 0x20); | ||
833 | |||
834 | func_exit(); | ||
835 | 831 | ||
836 | return &vpdp; | 832 | return &vpdp; |
837 | } | 833 | } |
838 | 834 | ||
839 | static struct tty_operations rio_ops = { | 835 | static struct tty_operations rio_ops = { |
840 | .open = riotopen, | 836 | .open = riotopen, |
841 | .close = gs_close, | 837 | .close = gs_close, |
842 | .write = gs_write, | 838 | .write = gs_write, |
843 | .put_char = gs_put_char, | 839 | .put_char = gs_put_char, |
@@ -889,7 +885,7 @@ static int rio_init_drivers(void) | |||
889 | rio_driver2->flags = TTY_DRIVER_REAL_RAW; | 885 | rio_driver2->flags = TTY_DRIVER_REAL_RAW; |
890 | tty_set_operations(rio_driver2, &rio_ops); | 886 | tty_set_operations(rio_driver2, &rio_ops); |
891 | 887 | ||
892 | rio_dprintk (RIO_DEBUG_INIT, "set_termios = %p\n", gs_set_termios); | 888 | rio_dprintk(RIO_DEBUG_INIT, "set_termios = %p\n", gs_set_termios); |
893 | 889 | ||
894 | if ((error = tty_register_driver(rio_driver))) | 890 | if ((error = tty_register_driver(rio_driver))) |
895 | goto out2; | 891 | goto out2; |
@@ -897,116 +893,111 @@ static int rio_init_drivers(void) | |||
897 | goto out3; | 893 | goto out3; |
898 | func_exit(); | 894 | func_exit(); |
899 | return 0; | 895 | return 0; |
900 | out3: | 896 | out3: |
901 | tty_unregister_driver(rio_driver); | 897 | tty_unregister_driver(rio_driver); |
902 | out2: | 898 | out2: |
903 | put_tty_driver(rio_driver2); | 899 | put_tty_driver(rio_driver2); |
904 | out1: | 900 | out1: |
905 | put_tty_driver(rio_driver); | 901 | put_tty_driver(rio_driver); |
906 | out: | 902 | out: |
907 | printk(KERN_ERR "rio: Couldn't register a rio driver, error = %d\n", | 903 | printk(KERN_ERR "rio: Couldn't register a rio driver, error = %d\n", error); |
908 | error); | ||
909 | return 1; | 904 | return 1; |
910 | } | 905 | } |
911 | 906 | ||
912 | 907 | ||
913 | static void * ckmalloc (int size) | 908 | static void *ckmalloc(int size) |
914 | { | 909 | { |
915 | void *p; | 910 | void *p; |
916 | 911 | ||
917 | p = kmalloc(size, GFP_KERNEL); | 912 | p = kmalloc(size, GFP_KERNEL); |
918 | if (p) | 913 | if (p) |
919 | memset(p, 0, size); | 914 | memset(p, 0, size); |
920 | return p; | 915 | return p; |
921 | } | 916 | } |
922 | 917 | ||
923 | 918 | ||
924 | 919 | ||
925 | static int rio_init_datastructures (void) | 920 | static int rio_init_datastructures(void) |
926 | { | 921 | { |
927 | int i; | 922 | int i; |
928 | struct Port *port; | 923 | struct Port *port; |
929 | func_enter(); | 924 | func_enter(); |
930 | 925 | ||
931 | /* Many drivers statically allocate the maximum number of ports | 926 | /* Many drivers statically allocate the maximum number of ports |
932 | There is no reason not to allocate them dynamically. Is there? -- REW */ | 927 | There is no reason not to allocate them dynamically. Is there? -- REW */ |
933 | /* However, the RIO driver allows users to configure their first | 928 | /* However, the RIO driver allows users to configure their first |
934 | RTA as the ports numbered 504-511. We therefore need to allocate | 929 | RTA as the ports numbered 504-511. We therefore need to allocate |
935 | the whole range. :-( -- REW */ | 930 | the whole range. :-( -- REW */ |
936 | 931 | ||
937 | #define RI_SZ sizeof(struct rio_info) | 932 | #define RI_SZ sizeof(struct rio_info) |
938 | #define HOST_SZ sizeof(struct Host) | 933 | #define HOST_SZ sizeof(struct Host) |
939 | #define PORT_SZ sizeof(struct Port *) | 934 | #define PORT_SZ sizeof(struct Port *) |
940 | #define TMIO_SZ sizeof(struct termios *) | 935 | #define TMIO_SZ sizeof(struct termios *) |
941 | rio_dprintk (RIO_DEBUG_INIT, "getting : %d %d %d %d %d bytes\n", | 936 | rio_dprintk(RIO_DEBUG_INIT, "getting : %d %d %d %d %d bytes\n", RI_SZ, RIO_HOSTS * HOST_SZ, RIO_PORTS * PORT_SZ, RIO_PORTS * TMIO_SZ, RIO_PORTS * TMIO_SZ); |
942 | RI_SZ, | 937 | |
943 | RIO_HOSTS * HOST_SZ, | 938 | if (!(p = ckmalloc(RI_SZ))) |
944 | RIO_PORTS * PORT_SZ, | 939 | goto free0; |
945 | RIO_PORTS * TMIO_SZ, | 940 | if (!(p->RIOHosts = ckmalloc(RIO_HOSTS * HOST_SZ))) |
946 | RIO_PORTS * TMIO_SZ); | 941 | goto free1; |
947 | 942 | if (!(p->RIOPortp = ckmalloc(RIO_PORTS * PORT_SZ))) | |
948 | if (!(p = ckmalloc ( RI_SZ))) goto free0; | 943 | goto free2; |
949 | if (!(p->RIOHosts = ckmalloc (RIO_HOSTS * HOST_SZ))) goto free1; | 944 | p->RIOConf = RIOConf; |
950 | if (!(p->RIOPortp = ckmalloc (RIO_PORTS * PORT_SZ))) goto free2; | 945 | rio_dprintk(RIO_DEBUG_INIT, "Got : %p %p %p\n", p, p->RIOHosts, p->RIOPortp); |
951 | p->RIOConf = RIOConf; | ||
952 | rio_dprintk (RIO_DEBUG_INIT, "Got : %p %p %p\n", | ||
953 | p, p->RIOHosts, p->RIOPortp); | ||
954 | 946 | ||
955 | #if 1 | 947 | #if 1 |
956 | for (i = 0; i < RIO_PORTS; i++) { | 948 | for (i = 0; i < RIO_PORTS; i++) { |
957 | port = p->RIOPortp[i] = ckmalloc (sizeof (struct Port)); | 949 | port = p->RIOPortp[i] = ckmalloc(sizeof(struct Port)); |
958 | if (!port) { | 950 | if (!port) { |
959 | goto free6; | 951 | goto free6; |
960 | } | 952 | } |
961 | rio_dprintk (RIO_DEBUG_INIT, "initing port %d (%d)\n", i, port->Mapped); | 953 | rio_dprintk(RIO_DEBUG_INIT, "initing port %d (%d)\n", i, port->Mapped); |
962 | port->PortNum = i; | 954 | port->PortNum = i; |
963 | port->gs.magic = RIO_MAGIC; | 955 | port->gs.magic = RIO_MAGIC; |
964 | port->gs.close_delay = HZ/2; | 956 | port->gs.close_delay = HZ / 2; |
965 | port->gs.closing_wait = 30 * HZ; | 957 | port->gs.closing_wait = 30 * HZ; |
966 | port->gs.rd = &rio_real_driver; | 958 | port->gs.rd = &rio_real_driver; |
967 | spin_lock_init(&port->portSem); | 959 | spin_lock_init(&port->portSem); |
968 | /* | 960 | /* |
969 | * Initializing wait queue | 961 | * Initializing wait queue |
970 | */ | 962 | */ |
971 | init_waitqueue_head(&port->gs.open_wait); | 963 | init_waitqueue_head(&port->gs.open_wait); |
972 | init_waitqueue_head(&port->gs.close_wait); | 964 | init_waitqueue_head(&port->gs.close_wait); |
973 | } | 965 | } |
974 | #else | 966 | #else |
975 | /* We could postpone initializing them to when they are configured. */ | 967 | /* We could postpone initializing them to when they are configured. */ |
976 | #endif | 968 | #endif |
977 | 969 | ||
978 | 970 | ||
979 | |||
980 | if (rio_debug & RIO_DEBUG_INIT) { | ||
981 | my_hd (&rio_real_driver, sizeof (rio_real_driver)); | ||
982 | } | ||
983 | 971 | ||
984 | 972 | if (rio_debug & RIO_DEBUG_INIT) { | |
985 | func_exit(); | 973 | my_hd(&rio_real_driver, sizeof(rio_real_driver)); |
986 | return 0; | 974 | } |
975 | |||
987 | 976 | ||
988 | free6:for (i--;i>=0;i--) | 977 | func_exit(); |
989 | kfree (p->RIOPortp[i]); | 978 | return 0; |
979 | |||
980 | free6:for (i--; i >= 0; i--) | ||
981 | kfree(p->RIOPortp[i]); | ||
990 | /*free5: | 982 | /*free5: |
991 | free4: | 983 | free4: |
992 | free3:*/kfree (p->RIOPortp); | 984 | free3:*/ kfree(p->RIOPortp); |
993 | free2:kfree (p->RIOHosts); | 985 | free2:kfree(p->RIOHosts); |
994 | free1: | 986 | free1: |
995 | rio_dprintk (RIO_DEBUG_INIT, "Not enough memory! %p %p %p\n", | 987 | rio_dprintk(RIO_DEBUG_INIT, "Not enough memory! %p %p %p\n", p, p->RIOHosts, p->RIOPortp); |
996 | p, p->RIOHosts, p->RIOPortp); | 988 | kfree(p); |
997 | kfree(p); | 989 | free0: |
998 | free0: | 990 | return -ENOMEM; |
999 | return -ENOMEM; | ||
1000 | } | 991 | } |
1001 | 992 | ||
1002 | static void __exit rio_release_drivers(void) | 993 | static void __exit rio_release_drivers(void) |
1003 | { | 994 | { |
1004 | func_enter(); | 995 | func_enter(); |
1005 | tty_unregister_driver(rio_driver2); | 996 | tty_unregister_driver(rio_driver2); |
1006 | tty_unregister_driver(rio_driver); | 997 | tty_unregister_driver(rio_driver); |
1007 | put_tty_driver(rio_driver2); | 998 | put_tty_driver(rio_driver2); |
1008 | put_tty_driver(rio_driver); | 999 | put_tty_driver(rio_driver); |
1009 | func_exit(); | 1000 | func_exit(); |
1010 | } | 1001 | } |
1011 | 1002 | ||
1012 | 1003 | ||
@@ -1017,7 +1008,7 @@ static void __exit rio_release_drivers(void) | |||
1017 | There is another bit besides Bit 17. Turning that bit off | 1008 | There is another bit besides Bit 17. Turning that bit off |
1018 | (on boards shipped with the fix in the eeprom) results in a | 1009 | (on boards shipped with the fix in the eeprom) results in a |
1019 | hang on the next access to the card. | 1010 | hang on the next access to the card. |
1020 | */ | 1011 | */ |
1021 | 1012 | ||
1022 | /******************************************************** | 1013 | /******************************************************** |
1023 | * Setting bit 17 in the CNTRL register of the PLX 9050 * | 1014 | * Setting bit 17 in the CNTRL register of the PLX 9050 * |
@@ -1030,319 +1021,293 @@ static void __exit rio_release_drivers(void) | |||
1030 | EEprom. As the bit is read/write for the CPU, we can fix it here, | 1021 | EEprom. As the bit is read/write for the CPU, we can fix it here, |
1031 | if we detect that it isn't set correctly. -- REW */ | 1022 | if we detect that it isn't set correctly. -- REW */ |
1032 | 1023 | ||
1033 | static void fix_rio_pci (struct pci_dev *pdev) | 1024 | static void fix_rio_pci(struct pci_dev *pdev) |
1034 | { | 1025 | { |
1035 | unsigned int hwbase; | 1026 | unsigned int hwbase; |
1036 | unsigned long rebase; | 1027 | unsigned long rebase; |
1037 | unsigned int t; | 1028 | unsigned int t; |
1038 | 1029 | ||
1039 | #define CNTRL_REG_OFFSET 0x50 | 1030 | #define CNTRL_REG_OFFSET 0x50 |
1040 | #define CNTRL_REG_GOODVALUE 0x18260000 | 1031 | #define CNTRL_REG_GOODVALUE 0x18260000 |
1041 | 1032 | ||
1042 | pci_read_config_dword(pdev, PCI_BASE_ADDRESS_0, &hwbase); | 1033 | pci_read_config_dword(pdev, PCI_BASE_ADDRESS_0, &hwbase); |
1043 | hwbase &= PCI_BASE_ADDRESS_MEM_MASK; | 1034 | hwbase &= PCI_BASE_ADDRESS_MEM_MASK; |
1044 | rebase = (ulong) ioremap(hwbase, 0x80); | 1035 | rebase = (ulong) ioremap(hwbase, 0x80); |
1045 | t = readl (rebase + CNTRL_REG_OFFSET); | 1036 | t = readl(rebase + CNTRL_REG_OFFSET); |
1046 | if (t != CNTRL_REG_GOODVALUE) { | 1037 | if (t != CNTRL_REG_GOODVALUE) { |
1047 | printk (KERN_DEBUG "rio: performing cntrl reg fix: %08x -> %08x\n", | 1038 | printk(KERN_DEBUG "rio: performing cntrl reg fix: %08x -> %08x\n", t, CNTRL_REG_GOODVALUE); |
1048 | t, CNTRL_REG_GOODVALUE); | 1039 | writel(CNTRL_REG_GOODVALUE, rebase + CNTRL_REG_OFFSET); |
1049 | writel (CNTRL_REG_GOODVALUE, rebase + CNTRL_REG_OFFSET); | 1040 | } |
1050 | } | 1041 | iounmap((char *) rebase); |
1051 | iounmap((char*) rebase); | ||
1052 | } | 1042 | } |
1053 | #endif | 1043 | #endif |
1054 | 1044 | ||
1055 | 1045 | ||
1056 | static int __init rio_init(void) | 1046 | static int __init rio_init(void) |
1057 | { | 1047 | { |
1058 | int found = 0; | 1048 | int found = 0; |
1059 | int i; | 1049 | int i; |
1060 | struct Host *hp; | 1050 | struct Host *hp; |
1061 | int retval; | 1051 | int retval; |
1062 | struct vpd_prom *vpdp; | 1052 | struct vpd_prom *vpdp; |
1063 | int okboard; | 1053 | int okboard; |
1064 | 1054 | ||
1065 | #ifdef CONFIG_PCI | 1055 | #ifdef CONFIG_PCI |
1066 | struct pci_dev *pdev = NULL; | 1056 | struct pci_dev *pdev = NULL; |
1067 | unsigned int tint; | 1057 | unsigned int tint; |
1068 | unsigned short tshort; | 1058 | unsigned short tshort; |
1069 | #endif | 1059 | #endif |
1070 | 1060 | ||
1071 | func_enter(); | 1061 | func_enter(); |
1072 | rio_dprintk (RIO_DEBUG_INIT, "Initing rio module... (rio_debug=%d)\n", | 1062 | rio_dprintk(RIO_DEBUG_INIT, "Initing rio module... (rio_debug=%d)\n", rio_debug); |
1073 | rio_debug); | 1063 | |
1074 | 1064 | if (abs((long) (&rio_debug) - rio_debug) < 0x10000) { | |
1075 | if (abs ((long) (&rio_debug) - rio_debug) < 0x10000) { | 1065 | printk(KERN_WARNING "rio: rio_debug is an address, instead of a value. " "Assuming -1. Was %x/%p.\n", rio_debug, &rio_debug); |
1076 | printk (KERN_WARNING "rio: rio_debug is an address, instead of a value. " | 1066 | rio_debug = -1; |
1077 | "Assuming -1. Was %x/%p.\n", rio_debug, &rio_debug); | 1067 | } |
1078 | rio_debug=-1; | 1068 | |
1079 | } | 1069 | if (misc_register(&rio_fw_device) < 0) { |
1080 | 1070 | printk(KERN_ERR "RIO: Unable to register firmware loader driver.\n"); | |
1081 | if (misc_register(&rio_fw_device) < 0) { | 1071 | return -EIO; |
1082 | printk(KERN_ERR "RIO: Unable to register firmware loader driver.\n"); | 1072 | } |
1083 | return -EIO; | 1073 | |
1084 | } | 1074 | retval = rio_init_datastructures(); |
1085 | 1075 | if (retval < 0) { | |
1086 | retval = rio_init_datastructures (); | 1076 | misc_deregister(&rio_fw_device); |
1087 | if (retval < 0) { | 1077 | return retval; |
1088 | misc_deregister(&rio_fw_device); | 1078 | } |
1089 | return retval; | ||
1090 | } | ||
1091 | |||
1092 | #ifdef CONFIG_PCI | 1079 | #ifdef CONFIG_PCI |
1093 | /* First look for the JET devices: */ | 1080 | /* First look for the JET devices: */ |
1094 | while ((pdev = pci_get_device (PCI_VENDOR_ID_SPECIALIX, | 1081 | while ((pdev = pci_get_device(PCI_VENDOR_ID_SPECIALIX, PCI_DEVICE_ID_SPECIALIX_SX_XIO_IO8, pdev))) { |
1095 | PCI_DEVICE_ID_SPECIALIX_SX_XIO_IO8, | 1082 | if (pci_enable_device(pdev)) |
1096 | pdev))) { | 1083 | continue; |
1097 | if (pci_enable_device(pdev)) continue; | 1084 | |
1098 | 1085 | /* Specialix has a whole bunch of cards with | |
1099 | /* Specialix has a whole bunch of cards with | 1086 | 0x2000 as the device ID. They say its because |
1100 | 0x2000 as the device ID. They say its because | 1087 | the standard requires it. Stupid standard. */ |
1101 | the standard requires it. Stupid standard. */ | 1088 | /* It seems that reading a word doesn't work reliably on 2.0. |
1102 | /* It seems that reading a word doesn't work reliably on 2.0. | 1089 | Also, reading a non-aligned dword doesn't work. So we read the |
1103 | Also, reading a non-aligned dword doesn't work. So we read the | 1090 | whole dword at 0x2c and extract the word at 0x2e (SUBSYSTEM_ID) |
1104 | whole dword at 0x2c and extract the word at 0x2e (SUBSYSTEM_ID) | 1091 | ourselves */ |
1105 | ourselves */ | 1092 | /* I don't know why the define doesn't work, constant 0x2c does --REW */ |
1106 | /* I don't know why the define doesn't work, constant 0x2c does --REW */ | 1093 | pci_read_config_dword(pdev, 0x2c, &tint); |
1107 | pci_read_config_dword (pdev, 0x2c, &tint); | 1094 | tshort = (tint >> 16) & 0xffff; |
1108 | tshort = (tint >> 16) & 0xffff; | 1095 | rio_dprintk(RIO_DEBUG_PROBE, "Got a specialix card: %x.\n", tint); |
1109 | rio_dprintk (RIO_DEBUG_PROBE, "Got a specialix card: %x.\n", tint); | 1096 | if (tshort != 0x0100) { |
1110 | if (tshort != 0x0100) { | 1097 | rio_dprintk(RIO_DEBUG_PROBE, "But it's not a RIO card (%d)...\n", tshort); |
1111 | rio_dprintk (RIO_DEBUG_PROBE, "But it's not a RIO card (%d)...\n", | 1098 | continue; |
1112 | tshort); | 1099 | } |
1113 | continue; | 1100 | rio_dprintk(RIO_DEBUG_PROBE, "cp1\n"); |
1114 | } | 1101 | |
1115 | rio_dprintk (RIO_DEBUG_PROBE, "cp1\n"); | 1102 | pci_read_config_dword(pdev, PCI_BASE_ADDRESS_2, &tint); |
1116 | 1103 | ||
1117 | pci_read_config_dword(pdev, PCI_BASE_ADDRESS_2, &tint); | 1104 | hp = &p->RIOHosts[p->RIONumHosts]; |
1118 | 1105 | hp->PaddrP = tint & PCI_BASE_ADDRESS_MEM_MASK; | |
1119 | hp = &p->RIOHosts[p->RIONumHosts]; | 1106 | hp->Ivec = pdev->irq; |
1120 | hp->PaddrP = tint & PCI_BASE_ADDRESS_MEM_MASK; | 1107 | if (((1 << hp->Ivec) & rio_irqmask) == 0) |
1121 | hp->Ivec = pdev->irq; | 1108 | hp->Ivec = 0; |
1122 | if (((1 << hp->Ivec) & rio_irqmask) == 0) | 1109 | hp->Caddr = ioremap(p->RIOHosts[p->RIONumHosts].PaddrP, RIO_WINDOW_LEN); |
1123 | hp->Ivec = 0; | 1110 | hp->CardP = (struct DpRam *) hp->Caddr; |
1124 | hp->Caddr = ioremap(p->RIOHosts[p->RIONumHosts].PaddrP, RIO_WINDOW_LEN); | 1111 | hp->Type = RIO_PCI; |
1125 | hp->CardP = (struct DpRam *) hp->Caddr; | 1112 | hp->Copy = rio_pcicopy; |
1126 | hp->Type = RIO_PCI; | 1113 | hp->Mode = RIO_PCI_BOOT_FROM_RAM; |
1127 | hp->Copy = rio_pcicopy; | 1114 | spin_lock_init(&hp->HostLock); |
1128 | hp->Mode = RIO_PCI_BOOT_FROM_RAM; | 1115 | rio_reset_interrupt(hp); |
1129 | spin_lock_init(&hp->HostLock); | 1116 | rio_start_card_running(hp); |
1130 | rio_reset_interrupt (hp); | 1117 | |
1131 | rio_start_card_running (hp); | 1118 | rio_dprintk(RIO_DEBUG_PROBE, "Going to test it (%p/%p).\n", (void *) p->RIOHosts[p->RIONumHosts].PaddrP, p->RIOHosts[p->RIONumHosts].Caddr); |
1132 | 1119 | if (RIOBoardTest(p->RIOHosts[p->RIONumHosts].PaddrP, p->RIOHosts[p->RIONumHosts].Caddr, RIO_PCI, 0) == RIO_SUCCESS) { | |
1133 | rio_dprintk (RIO_DEBUG_PROBE, "Going to test it (%p/%p).\n", | 1120 | rio_dprintk(RIO_DEBUG_INIT, "Done RIOBoardTest\n"); |
1134 | (void *)p->RIOHosts[p->RIONumHosts].PaddrP, | 1121 | WBYTE(p->RIOHosts[p->RIONumHosts].ResetInt, 0xff); |
1135 | p->RIOHosts[p->RIONumHosts].Caddr); | 1122 | p->RIOHosts[p->RIONumHosts].UniqueNum = |
1136 | if (RIOBoardTest( p->RIOHosts[p->RIONumHosts].PaddrP, | 1123 | ((RBYTE(p->RIOHosts[p->RIONumHosts].Unique[0]) & 0xFF) << 0) | |
1137 | p->RIOHosts[p->RIONumHosts].Caddr, | 1124 | ((RBYTE(p->RIOHosts[p->RIONumHosts].Unique[1]) & 0xFF) << 8) | ((RBYTE(p->RIOHosts[p->RIONumHosts].Unique[2]) & 0xFF) << 16) | ((RBYTE(p->RIOHosts[p->RIONumHosts].Unique[3]) & 0xFF) << 24); |
1138 | RIO_PCI, 0 ) == RIO_SUCCESS) { | 1125 | rio_dprintk(RIO_DEBUG_PROBE, "Hmm Tested ok, uniqid = %x.\n", p->RIOHosts[p->RIONumHosts].UniqueNum); |
1139 | rio_dprintk (RIO_DEBUG_INIT, "Done RIOBoardTest\n"); | 1126 | |
1140 | WBYTE(p->RIOHosts[p->RIONumHosts].ResetInt, 0xff); | 1127 | fix_rio_pci(pdev); |
1141 | p->RIOHosts[p->RIONumHosts].UniqueNum = | 1128 | p->RIOLastPCISearch = RIO_SUCCESS; |
1142 | ((RBYTE(p->RIOHosts[p->RIONumHosts].Unique[0]) &0xFF)<< 0)| | 1129 | p->RIONumHosts++; |
1143 | ((RBYTE(p->RIOHosts[p->RIONumHosts].Unique[1]) &0xFF)<< 8)| | 1130 | found++; |
1144 | ((RBYTE(p->RIOHosts[p->RIONumHosts].Unique[2]) &0xFF)<<16)| | 1131 | } else { |
1145 | ((RBYTE(p->RIOHosts[p->RIONumHosts].Unique[3]) &0xFF)<<24); | 1132 | iounmap((char *) (p->RIOHosts[p->RIONumHosts].Caddr)); |
1146 | rio_dprintk (RIO_DEBUG_PROBE, "Hmm Tested ok, uniqid = %x.\n", | 1133 | } |
1147 | p->RIOHosts[p->RIONumHosts].UniqueNum); | 1134 | } |
1148 | 1135 | ||
1149 | fix_rio_pci (pdev); | 1136 | /* Then look for the older PCI card.... : */ |
1150 | p->RIOLastPCISearch = RIO_SUCCESS; | 1137 | |
1151 | p->RIONumHosts++; | 1138 | /* These older PCI cards have problems (only byte-mode access is |
1152 | found++; | 1139 | supported), which makes them a bit awkward to support. |
1153 | } else { | 1140 | They also have problems sharing interrupts. Be careful. |
1154 | iounmap((char*) (p->RIOHosts[p->RIONumHosts].Caddr)); | 1141 | (The driver now refuses to share interrupts for these |
1155 | } | 1142 | cards. This should be sufficient). |
1156 | } | 1143 | */ |
1157 | 1144 | ||
1158 | /* Then look for the older PCI card.... : */ | 1145 | /* Then look for the older RIO/PCI devices: */ |
1159 | 1146 | while ((pdev = pci_get_device(PCI_VENDOR_ID_SPECIALIX, PCI_DEVICE_ID_SPECIALIX_RIO, pdev))) { | |
1160 | /* These older PCI cards have problems (only byte-mode access is | 1147 | if (pci_enable_device(pdev)) |
1161 | supported), which makes them a bit awkward to support. | 1148 | continue; |
1162 | They also have problems sharing interrupts. Be careful. | ||
1163 | (The driver now refuses to share interrupts for these | ||
1164 | cards. This should be sufficient). | ||
1165 | */ | ||
1166 | |||
1167 | /* Then look for the older RIO/PCI devices: */ | ||
1168 | while ((pdev = pci_get_device (PCI_VENDOR_ID_SPECIALIX, | ||
1169 | PCI_DEVICE_ID_SPECIALIX_RIO, | ||
1170 | pdev))) { | ||
1171 | if (pci_enable_device(pdev)) continue; | ||
1172 | 1149 | ||
1173 | #ifdef CONFIG_RIO_OLDPCI | 1150 | #ifdef CONFIG_RIO_OLDPCI |
1174 | pci_read_config_dword(pdev, PCI_BASE_ADDRESS_0, &tint); | 1151 | pci_read_config_dword(pdev, PCI_BASE_ADDRESS_0, &tint); |
1175 | 1152 | ||
1176 | hp = &p->RIOHosts[p->RIONumHosts]; | 1153 | hp = &p->RIOHosts[p->RIONumHosts]; |
1177 | hp->PaddrP = tint & PCI_BASE_ADDRESS_MEM_MASK; | 1154 | hp->PaddrP = tint & PCI_BASE_ADDRESS_MEM_MASK; |
1178 | hp->Ivec = pdev->irq; | 1155 | hp->Ivec = pdev->irq; |
1179 | if (((1 << hp->Ivec) & rio_irqmask) == 0) | 1156 | if (((1 << hp->Ivec) & rio_irqmask) == 0) |
1180 | hp->Ivec = 0; | 1157 | hp->Ivec = 0; |
1181 | hp->Ivec |= 0x8000; /* Mark as non-sharable */ | 1158 | hp->Ivec |= 0x8000; /* Mark as non-sharable */ |
1182 | hp->Caddr = ioremap(p->RIOHosts[p->RIONumHosts].PaddrP, RIO_WINDOW_LEN); | 1159 | hp->Caddr = ioremap(p->RIOHosts[p->RIONumHosts].PaddrP, RIO_WINDOW_LEN); |
1183 | hp->CardP = (struct DpRam *) hp->Caddr; | 1160 | hp->CardP = (struct DpRam *) hp->Caddr; |
1184 | hp->Type = RIO_PCI; | 1161 | hp->Type = RIO_PCI; |
1185 | hp->Copy = rio_pcicopy; | 1162 | hp->Copy = rio_pcicopy; |
1186 | hp->Mode = RIO_PCI_BOOT_FROM_RAM; | 1163 | hp->Mode = RIO_PCI_BOOT_FROM_RAM; |
1187 | spin_lock_init(&hp->HostLock); | 1164 | spin_lock_init(&hp->HostLock); |
1188 | 1165 | ||
1189 | rio_dprintk (RIO_DEBUG_PROBE, "Ivec: %x\n", hp->Ivec); | 1166 | rio_dprintk(RIO_DEBUG_PROBE, "Ivec: %x\n", hp->Ivec); |
1190 | rio_dprintk (RIO_DEBUG_PROBE, "Mode: %x\n", hp->Mode); | 1167 | rio_dprintk(RIO_DEBUG_PROBE, "Mode: %x\n", hp->Mode); |
1191 | 1168 | ||
1192 | rio_reset_interrupt (hp); | 1169 | rio_reset_interrupt(hp); |
1193 | rio_start_card_running (hp); | 1170 | rio_start_card_running(hp); |
1194 | rio_dprintk (RIO_DEBUG_PROBE, "Going to test it (%p/%p).\n", | 1171 | rio_dprintk(RIO_DEBUG_PROBE, "Going to test it (%p/%p).\n", (void *) p->RIOHosts[p->RIONumHosts].PaddrP, p->RIOHosts[p->RIONumHosts].Caddr); |
1195 | (void *)p->RIOHosts[p->RIONumHosts].PaddrP, | 1172 | if (RIOBoardTest(p->RIOHosts[p->RIONumHosts].PaddrP, p->RIOHosts[p->RIONumHosts].Caddr, RIO_PCI, 0) == RIO_SUCCESS) { |
1196 | p->RIOHosts[p->RIONumHosts].Caddr); | 1173 | WBYTE(p->RIOHosts[p->RIONumHosts].ResetInt, 0xff); |
1197 | if (RIOBoardTest( p->RIOHosts[p->RIONumHosts].PaddrP, | 1174 | p->RIOHosts[p->RIONumHosts].UniqueNum = |
1198 | p->RIOHosts[p->RIONumHosts].Caddr, | 1175 | ((RBYTE(p->RIOHosts[p->RIONumHosts].Unique[0]) & 0xFF) << 0) | |
1199 | RIO_PCI, 0 ) == RIO_SUCCESS) { | 1176 | ((RBYTE(p->RIOHosts[p->RIONumHosts].Unique[1]) & 0xFF) << 8) | ((RBYTE(p->RIOHosts[p->RIONumHosts].Unique[2]) & 0xFF) << 16) | ((RBYTE(p->RIOHosts[p->RIONumHosts].Unique[3]) & 0xFF) << 24); |
1200 | WBYTE(p->RIOHosts[p->RIONumHosts].ResetInt, 0xff); | 1177 | rio_dprintk(RIO_DEBUG_PROBE, "Hmm Tested ok, uniqid = %x.\n", p->RIOHosts[p->RIONumHosts].UniqueNum); |
1201 | p->RIOHosts[p->RIONumHosts].UniqueNum = | 1178 | |
1202 | ((RBYTE(p->RIOHosts[p->RIONumHosts].Unique[0]) &0xFF)<< 0)| | 1179 | p->RIOLastPCISearch = RIO_SUCCESS; |
1203 | ((RBYTE(p->RIOHosts[p->RIONumHosts].Unique[1]) &0xFF)<< 8)| | 1180 | p->RIONumHosts++; |
1204 | ((RBYTE(p->RIOHosts[p->RIONumHosts].Unique[2]) &0xFF)<<16)| | 1181 | found++; |
1205 | ((RBYTE(p->RIOHosts[p->RIONumHosts].Unique[3]) &0xFF)<<24); | 1182 | } else { |
1206 | rio_dprintk (RIO_DEBUG_PROBE, "Hmm Tested ok, uniqid = %x.\n", | 1183 | iounmap((char *) (p->RIOHosts[p->RIONumHosts].Caddr)); |
1207 | p->RIOHosts[p->RIONumHosts].UniqueNum); | 1184 | } |
1208 | |||
1209 | p->RIOLastPCISearch = RIO_SUCCESS; | ||
1210 | p->RIONumHosts++; | ||
1211 | found++; | ||
1212 | } else { | ||
1213 | iounmap((char*) (p->RIOHosts[p->RIONumHosts].Caddr)); | ||
1214 | } | ||
1215 | #else | 1185 | #else |
1216 | printk (KERN_ERR "Found an older RIO PCI card, but the driver is not " | 1186 | printk(KERN_ERR "Found an older RIO PCI card, but the driver is not " "compiled to support it.\n"); |
1217 | "compiled to support it.\n"); | ||
1218 | #endif | 1187 | #endif |
1219 | } | 1188 | } |
1220 | #endif /* PCI */ | 1189 | #endif /* PCI */ |
1221 | 1190 | ||
1222 | /* Now probe for ISA cards... */ | 1191 | /* Now probe for ISA cards... */ |
1223 | for (i=0;i<NR_RIO_ADDRS;i++) { | 1192 | for (i = 0; i < NR_RIO_ADDRS; i++) { |
1224 | hp = &p->RIOHosts[p->RIONumHosts]; | 1193 | hp = &p->RIOHosts[p->RIONumHosts]; |
1225 | hp->PaddrP = rio_probe_addrs[i]; | 1194 | hp->PaddrP = rio_probe_addrs[i]; |
1226 | /* There was something about the IRQs of these cards. 'Forget what.--REW */ | 1195 | /* There was something about the IRQs of these cards. 'Forget what.--REW */ |
1227 | hp->Ivec = 0; | 1196 | hp->Ivec = 0; |
1228 | hp->Caddr = ioremap(p->RIOHosts[p->RIONumHosts].PaddrP, RIO_WINDOW_LEN); | 1197 | hp->Caddr = ioremap(p->RIOHosts[p->RIONumHosts].PaddrP, RIO_WINDOW_LEN); |
1229 | hp->CardP = (struct DpRam *) hp->Caddr; | 1198 | hp->CardP = (struct DpRam *) hp->Caddr; |
1230 | hp->Type = RIO_AT; | 1199 | hp->Type = RIO_AT; |
1231 | hp->Copy = rio_pcicopy; /* AT card PCI???? - PVDL | 1200 | hp->Copy = rio_pcicopy; /* AT card PCI???? - PVDL |
1232 | * -- YES! this is now a normal copy. Only the | 1201 | * -- YES! this is now a normal copy. Only the |
1233 | * old PCI card uses the special PCI copy. | 1202 | * old PCI card uses the special PCI copy. |
1234 | * Moreover, the ISA card will work with the | 1203 | * Moreover, the ISA card will work with the |
1235 | * special PCI copy anyway. -- REW */ | 1204 | * special PCI copy anyway. -- REW */ |
1236 | hp->Mode = 0; | 1205 | hp->Mode = 0; |
1237 | spin_lock_init(&hp->HostLock); | 1206 | spin_lock_init(&hp->HostLock); |
1238 | 1207 | ||
1239 | vpdp = get_VPD_PROM (hp); | 1208 | vpdp = get_VPD_PROM(hp); |
1240 | rio_dprintk (RIO_DEBUG_PROBE, "Got VPD ROM\n"); | 1209 | rio_dprintk(RIO_DEBUG_PROBE, "Got VPD ROM\n"); |
1241 | okboard = 0; | 1210 | okboard = 0; |
1242 | if ((strncmp (vpdp->identifier, RIO_ISA_IDENT, 16) == 0) || | 1211 | 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)) { |
1243 | (strncmp (vpdp->identifier, RIO_ISA2_IDENT, 16) == 0) || | 1212 | /* Board is present... */ |
1244 | (strncmp (vpdp->identifier, RIO_ISA3_IDENT, 16) == 0)) { | 1213 | if (RIOBoardTest(hp->PaddrP, hp->Caddr, RIO_AT, 0) == RIO_SUCCESS) { |
1245 | /* Board is present... */ | 1214 | /* ... and feeling fine!!!! */ |
1246 | if (RIOBoardTest (hp->PaddrP, | 1215 | rio_dprintk(RIO_DEBUG_PROBE, "Hmm Tested ok, uniqid = %x.\n", p->RIOHosts[p->RIONumHosts].UniqueNum); |
1247 | hp->Caddr, RIO_AT, 0) == RIO_SUCCESS) { | 1216 | if (RIOAssignAT(p, hp->PaddrP, hp->Caddr, 0)) { |
1248 | /* ... and feeling fine!!!! */ | 1217 | rio_dprintk(RIO_DEBUG_PROBE, "Hmm Tested ok, host%d uniqid = %x.\n", p->RIONumHosts, p->RIOHosts[p->RIONumHosts - 1].UniqueNum); |
1249 | rio_dprintk (RIO_DEBUG_PROBE, "Hmm Tested ok, uniqid = %x.\n", | 1218 | okboard++; |
1250 | p->RIOHosts[p->RIONumHosts].UniqueNum); | 1219 | found++; |
1251 | if (RIOAssignAT(p, hp->PaddrP, hp->Caddr, 0)) { | 1220 | } |
1252 | rio_dprintk (RIO_DEBUG_PROBE, "Hmm Tested ok, host%d uniqid = %x.\n", | 1221 | } |
1253 | p->RIONumHosts, | 1222 | |
1254 | p->RIOHosts[p->RIONumHosts-1].UniqueNum); | 1223 | if (!okboard) |
1255 | okboard++; | 1224 | iounmap((char *) (hp->Caddr)); |
1256 | found++; | 1225 | } |
1257 | } | 1226 | } |
1258 | } | 1227 | |
1259 | 1228 | ||
1260 | if (!okboard) | 1229 | for (i = 0; i < p->RIONumHosts; i++) { |
1261 | iounmap ((char*) (hp->Caddr)); | 1230 | hp = &p->RIOHosts[i]; |
1262 | } | 1231 | if (hp->Ivec) { |
1263 | } | 1232 | int mode = SA_SHIRQ; |
1264 | 1233 | if (hp->Ivec & 0x8000) { | |
1265 | 1234 | mode = 0; | |
1266 | for (i=0;i<p->RIONumHosts;i++) { | 1235 | hp->Ivec &= 0x7fff; |
1267 | hp = &p->RIOHosts[i]; | 1236 | } |
1268 | if (hp->Ivec) { | 1237 | rio_dprintk(RIO_DEBUG_INIT, "Requesting interrupt hp: %p rio_interrupt: %d Mode: %x\n", hp, hp->Ivec, hp->Mode); |
1269 | int mode = SA_SHIRQ; | 1238 | retval = request_irq(hp->Ivec, rio_interrupt, mode, "rio", hp); |
1270 | if (hp->Ivec & 0x8000) {mode = 0; hp->Ivec &= 0x7fff;} | 1239 | rio_dprintk(RIO_DEBUG_INIT, "Return value from request_irq: %d\n", retval); |
1271 | rio_dprintk (RIO_DEBUG_INIT, "Requesting interrupt hp: %p rio_interrupt: %d Mode: %x\n", hp,hp->Ivec, hp->Mode); | 1240 | if (retval) { |
1272 | retval = request_irq (hp->Ivec, rio_interrupt, mode, "rio", hp); | 1241 | printk(KERN_ERR "rio: Cannot allocate irq %d.\n", hp->Ivec); |
1273 | rio_dprintk (RIO_DEBUG_INIT, "Return value from request_irq: %d\n", retval); | 1242 | hp->Ivec = 0; |
1274 | if (retval) { | 1243 | } |
1275 | printk(KERN_ERR "rio: Cannot allocate irq %d.\n", hp->Ivec); | 1244 | rio_dprintk(RIO_DEBUG_INIT, "Got irq %d.\n", hp->Ivec); |
1276 | hp->Ivec = 0; | 1245 | if (hp->Ivec != 0) { |
1277 | } | 1246 | rio_dprintk(RIO_DEBUG_INIT, "Enabling interrupts on rio card.\n"); |
1278 | rio_dprintk (RIO_DEBUG_INIT, "Got irq %d.\n", hp->Ivec); | 1247 | hp->Mode |= RIO_PCI_INT_ENABLE; |
1279 | if (hp->Ivec != 0){ | 1248 | } else |
1280 | rio_dprintk (RIO_DEBUG_INIT, "Enabling interrupts on rio card.\n"); | 1249 | hp->Mode &= !RIO_PCI_INT_ENABLE; |
1281 | hp->Mode |= RIO_PCI_INT_ENABLE; | 1250 | rio_dprintk(RIO_DEBUG_INIT, "New Mode: %x\n", hp->Mode); |
1282 | } else | 1251 | rio_start_card_running(hp); |
1283 | hp->Mode &= !RIO_PCI_INT_ENABLE; | 1252 | } |
1284 | rio_dprintk (RIO_DEBUG_INIT, "New Mode: %x\n", hp->Mode); | 1253 | /* Init the timer "always" to make sure that it can safely be |
1285 | rio_start_card_running (hp); | 1254 | deleted when we unload... */ |
1286 | } | 1255 | |
1287 | /* Init the timer "always" to make sure that it can safely be | 1256 | init_timer(&hp->timer); |
1288 | deleted when we unload... */ | 1257 | if (!hp->Ivec) { |
1289 | 1258 | rio_dprintk(RIO_DEBUG_INIT, "Starting polling at %dj intervals.\n", rio_poll); | |
1290 | init_timer (&hp->timer); | 1259 | hp->timer.data = i; |
1291 | if (!hp->Ivec) { | 1260 | hp->timer.function = rio_pollfunc; |
1292 | rio_dprintk (RIO_DEBUG_INIT, "Starting polling at %dj intervals.\n", | 1261 | hp->timer.expires = jiffies + rio_poll; |
1293 | rio_poll); | 1262 | add_timer(&hp->timer); |
1294 | hp->timer.data = i; | 1263 | } |
1295 | hp->timer.function = rio_pollfunc; | 1264 | } |
1296 | hp->timer.expires = jiffies + rio_poll; | 1265 | |
1297 | add_timer (&hp->timer); | 1266 | if (found) { |
1298 | } | 1267 | rio_dprintk(RIO_DEBUG_INIT, "rio: total of %d boards detected.\n", found); |
1299 | } | 1268 | rio_init_drivers(); |
1300 | 1269 | } else { | |
1301 | if (found) { | 1270 | /* deregister the misc device we created earlier */ |
1302 | rio_dprintk (RIO_DEBUG_INIT, "rio: total of %d boards detected.\n", found); | 1271 | misc_deregister(&rio_fw_device); |
1303 | rio_init_drivers (); | 1272 | } |
1304 | } else { | 1273 | |
1305 | /* deregister the misc device we created earlier */ | 1274 | func_exit(); |
1306 | misc_deregister(&rio_fw_device); | 1275 | return found ? 0 : -EIO; |
1307 | } | ||
1308 | |||
1309 | func_exit(); | ||
1310 | return found?0:-EIO; | ||
1311 | } | 1276 | } |
1312 | 1277 | ||
1313 | 1278 | ||
1314 | static void __exit rio_exit (void) | 1279 | static void __exit rio_exit(void) |
1315 | { | 1280 | { |
1316 | int i; | 1281 | int i; |
1317 | struct Host *hp; | 1282 | struct Host *hp; |
1318 | 1283 | ||
1319 | func_enter(); | 1284 | func_enter(); |
1320 | 1285 | ||
1321 | for (i=0,hp=p->RIOHosts;i<p->RIONumHosts;i++, hp++) { | 1286 | for (i = 0, hp = p->RIOHosts; i < p->RIONumHosts; i++, hp++) { |
1322 | RIOHostReset (hp->Type, hp->CardP, hp->Slot); | 1287 | RIOHostReset(hp->Type, hp->CardP, hp->Slot); |
1323 | if (hp->Ivec) { | 1288 | if (hp->Ivec) { |
1324 | free_irq (hp->Ivec, hp); | 1289 | free_irq(hp->Ivec, hp); |
1325 | rio_dprintk (RIO_DEBUG_INIT, "freed irq %d.\n", hp->Ivec); | 1290 | rio_dprintk(RIO_DEBUG_INIT, "freed irq %d.\n", hp->Ivec); |
1326 | } | 1291 | } |
1327 | /* It is safe/allowed to del_timer a non-active timer */ | 1292 | /* It is safe/allowed to del_timer a non-active timer */ |
1328 | del_timer (&hp->timer); | 1293 | del_timer(&hp->timer); |
1329 | } | 1294 | } |
1330 | 1295 | ||
1331 | if (misc_deregister(&rio_fw_device) < 0) { | 1296 | if (misc_deregister(&rio_fw_device) < 0) { |
1332 | printk (KERN_INFO "rio: couldn't deregister control-device\n"); | 1297 | printk(KERN_INFO "rio: couldn't deregister control-device\n"); |
1333 | } | 1298 | } |
1334 | 1299 | ||
1335 | 1300 | ||
1336 | rio_dprintk (RIO_DEBUG_CLEANUP, "Cleaning up drivers\n"); | 1301 | rio_dprintk(RIO_DEBUG_CLEANUP, "Cleaning up drivers\n"); |
1337 | 1302 | ||
1338 | rio_release_drivers (); | 1303 | rio_release_drivers(); |
1339 | 1304 | ||
1340 | /* Release dynamically allocated memory */ | 1305 | /* Release dynamically allocated memory */ |
1341 | kfree (p->RIOPortp); | 1306 | kfree(p->RIOPortp); |
1342 | kfree (p->RIOHosts); | 1307 | kfree(p->RIOHosts); |
1343 | kfree (p); | 1308 | kfree(p); |
1344 | 1309 | ||
1345 | func_exit(); | 1310 | func_exit(); |
1346 | } | 1311 | } |
1347 | 1312 | ||
1348 | module_init(rio_init); | 1313 | module_init(rio_init); |
@@ -1368,4 +1333,3 @@ module_exit(rio_exit); | |||
1368 | * tab-width: 8 | 1333 | * tab-width: 8 |
1369 | * End: | 1334 | * End: |
1370 | */ | 1335 | */ |
1371 | |||
diff --git a/drivers/char/rio/rio_linux.h b/drivers/char/rio/rio_linux.h index 1fba19d5b66a..4ce77fb1fae5 100644 --- a/drivers/char/rio/rio_linux.h +++ b/drivers/char/rio/rio_linux.h | |||
@@ -37,15 +37,15 @@ | |||
37 | 37 | ||
38 | 38 | ||
39 | struct vpd_prom { | 39 | struct vpd_prom { |
40 | unsigned short id; | 40 | unsigned short id; |
41 | char hwrev; | 41 | char hwrev; |
42 | char hwass; | 42 | char hwass; |
43 | int uniqid; | 43 | int uniqid; |
44 | char myear; | 44 | char myear; |
45 | char mweek; | 45 | char mweek; |
46 | char hw_feature[5]; | 46 | char hw_feature[5]; |
47 | char oem_id; | 47 | char oem_id; |
48 | char identifier[16]; | 48 | char identifier[16]; |
49 | }; | 49 | }; |
50 | 50 | ||
51 | 51 | ||
@@ -75,13 +75,13 @@ struct vpd_prom { | |||
75 | (L_ISIG(tty))) | 75 | (L_ISIG(tty))) |
76 | 76 | ||
77 | 77 | ||
78 | #endif /* __KERNEL__ */ | 78 | #endif /* __KERNEL__ */ |
79 | 79 | ||
80 | 80 | ||
81 | #define RIO_BOARD_INTR_LOCK 1 | 81 | #define RIO_BOARD_INTR_LOCK 1 |
82 | 82 | ||
83 | 83 | ||
84 | #ifndef RIOCTL_MISC_MINOR | 84 | #ifndef RIOCTL_MISC_MINOR |
85 | /* Allow others to gather this into "major.h" or something like that */ | 85 | /* Allow others to gather this into "major.h" or something like that */ |
86 | #define RIOCTL_MISC_MINOR 169 | 86 | #define RIOCTL_MISC_MINOR 169 |
87 | #endif | 87 | #endif |
@@ -121,39 +121,39 @@ struct vpd_prom { | |||
121 | spin_unlock_irqrestore(sem, flags) | 121 | spin_unlock_irqrestore(sem, flags) |
122 | 122 | ||
123 | #define rio_spin_lock(sem) \ | 123 | #define rio_spin_lock(sem) \ |
124 | spin_lock(sem) | 124 | spin_lock(sem) |
125 | 125 | ||
126 | #define rio_spin_unlock(sem) \ | 126 | #define rio_spin_unlock(sem) \ |
127 | spin_unlock(sem) | 127 | spin_unlock(sem) |
128 | 128 | ||
129 | #endif | 129 | #endif |
130 | 130 | ||
131 | 131 | ||
132 | 132 | ||
133 | #ifdef CONFIG_RIO_OLDPCI | 133 | #ifdef CONFIG_RIO_OLDPCI |
134 | static inline void *rio_memcpy_toio (void *dummy, void *dest, void *source, int n) | 134 | static inline void *rio_memcpy_toio(void *dummy, void *dest, void *source, int n) |
135 | { | 135 | { |
136 | char *dst = dest; | 136 | char *dst = dest; |
137 | char *src = source; | 137 | char *src = source; |
138 | 138 | ||
139 | while (n--) { | 139 | while (n--) { |
140 | writeb (*src++, dst++); | 140 | writeb(*src++, dst++); |
141 | (void) readb (dummy); | 141 | (void) readb(dummy); |
142 | } | 142 | } |
143 | 143 | ||
144 | return dest; | 144 | return dest; |
145 | } | 145 | } |
146 | 146 | ||
147 | 147 | ||
148 | static inline void *rio_memcpy_fromio (void *dest, void *source, int n) | 148 | static inline void *rio_memcpy_fromio(void *dest, void *source, int n) |
149 | { | 149 | { |
150 | char *dst = dest; | 150 | char *dst = dest; |
151 | char *src = source; | 151 | char *src = source; |
152 | 152 | ||
153 | while (n--) | 153 | while (n--) |
154 | *dst++ = readb (src++); | 154 | *dst++ = readb(src++); |
155 | 155 | ||
156 | return dest; | 156 | return dest; |
157 | } | 157 | } |
158 | 158 | ||
159 | #else | 159 | #else |
@@ -179,9 +179,8 @@ static inline void *rio_memcpy_fromio (void *dest, void *source, int n) | |||
179 | #define func_exit() rio_dprintk (RIO_DEBUG_FLOW, "rio: exit %s\n", __FUNCTION__) | 179 | #define func_exit() rio_dprintk (RIO_DEBUG_FLOW, "rio: exit %s\n", __FUNCTION__) |
180 | #define func_enter2() rio_dprintk (RIO_DEBUG_FLOW, "rio: enter %s (port %d)\n",__FUNCTION__, port->line) | 180 | #define func_enter2() rio_dprintk (RIO_DEBUG_FLOW, "rio: enter %s (port %d)\n",__FUNCTION__, port->line) |
181 | #else | 181 | #else |
182 | #define rio_dprintk(f, str...) /* nothing */ | 182 | #define rio_dprintk(f, str...) /* nothing */ |
183 | #define func_enter() | 183 | #define func_enter() |
184 | #define func_exit() | 184 | #define func_exit() |
185 | #define func_enter2() | 185 | #define func_enter2() |
186 | #endif | 186 | #endif |
187 | |||
diff --git a/drivers/char/rio/rioboard.h b/drivers/char/rio/rioboard.h index cc6ac6a98f65..822c071a693b 100644 --- a/drivers/char/rio/rioboard.h +++ b/drivers/char/rio/rioboard.h | |||
@@ -35,7 +35,7 @@ | |||
35 | 35 | ||
36 | */ | 36 | */ |
37 | 37 | ||
38 | #ifndef _rioboard_h /* If RIOBOARD.H not already defined */ | 38 | #ifndef _rioboard_h /* If RIOBOARD.H not already defined */ |
39 | #define _rioboard_h 1 | 39 | #define _rioboard_h 1 |
40 | 40 | ||
41 | /***************************************************************************** | 41 | /***************************************************************************** |
@@ -46,7 +46,7 @@ | |||
46 | 46 | ||
47 | /* Hardware Registers... */ | 47 | /* Hardware Registers... */ |
48 | 48 | ||
49 | #define RIO_REG_BASE 0x7C00 /* Base of control registers */ | 49 | #define RIO_REG_BASE 0x7C00 /* Base of control registers */ |
50 | 50 | ||
51 | #define RIO_CONFIG RIO_REG_BASE + 0x0000 /* WRITE: Configuration Register */ | 51 | #define RIO_CONFIG RIO_REG_BASE + 0x0000 /* WRITE: Configuration Register */ |
52 | #define RIO_INTSET RIO_REG_BASE + 0x0080 /* WRITE: Interrupt Set */ | 52 | #define RIO_INTSET RIO_REG_BASE + 0x0080 /* WRITE: Interrupt Set */ |
@@ -58,30 +58,30 @@ | |||
58 | #define RIO_RESETSTAT RIO_REG_BASE + 0x0100 /* READ: Reset Status (Jet boards only) */ | 58 | #define RIO_RESETSTAT RIO_REG_BASE + 0x0100 /* READ: Reset Status (Jet boards only) */ |
59 | 59 | ||
60 | /* RIO_VPD_ROM definitions... */ | 60 | /* RIO_VPD_ROM definitions... */ |
61 | #define VPD_SLX_ID1 0x00 /* READ: Specialix Identifier #1 */ | 61 | #define VPD_SLX_ID1 0x00 /* READ: Specialix Identifier #1 */ |
62 | #define VPD_SLX_ID2 0x01 /* READ: Specialix Identifier #2 */ | 62 | #define VPD_SLX_ID2 0x01 /* READ: Specialix Identifier #2 */ |
63 | #define VPD_HW_REV 0x02 /* READ: Hardware Revision */ | 63 | #define VPD_HW_REV 0x02 /* READ: Hardware Revision */ |
64 | #define VPD_HW_ASSEM 0x03 /* READ: Hardware Assembly Level */ | 64 | #define VPD_HW_ASSEM 0x03 /* READ: Hardware Assembly Level */ |
65 | #define VPD_UNIQUEID4 0x04 /* READ: Unique Identifier #4 */ | 65 | #define VPD_UNIQUEID4 0x04 /* READ: Unique Identifier #4 */ |
66 | #define VPD_UNIQUEID3 0x05 /* READ: Unique Identifier #3 */ | 66 | #define VPD_UNIQUEID3 0x05 /* READ: Unique Identifier #3 */ |
67 | #define VPD_UNIQUEID2 0x06 /* READ: Unique Identifier #2 */ | 67 | #define VPD_UNIQUEID2 0x06 /* READ: Unique Identifier #2 */ |
68 | #define VPD_UNIQUEID1 0x07 /* READ: Unique Identifier #1 */ | 68 | #define VPD_UNIQUEID1 0x07 /* READ: Unique Identifier #1 */ |
69 | #define VPD_MANU_YEAR 0x08 /* READ: Year Of Manufacture (0 = 1970) */ | 69 | #define VPD_MANU_YEAR 0x08 /* READ: Year Of Manufacture (0 = 1970) */ |
70 | #define VPD_MANU_WEEK 0x09 /* READ: Week Of Manufacture (0 = week 1 Jan) */ | 70 | #define VPD_MANU_WEEK 0x09 /* READ: Week Of Manufacture (0 = week 1 Jan) */ |
71 | #define VPD_HWFEATURE1 0x0A /* READ: Hardware Feature Byte 1 */ | 71 | #define VPD_HWFEATURE1 0x0A /* READ: Hardware Feature Byte 1 */ |
72 | #define VPD_HWFEATURE2 0x0B /* READ: Hardware Feature Byte 2 */ | 72 | #define VPD_HWFEATURE2 0x0B /* READ: Hardware Feature Byte 2 */ |
73 | #define VPD_HWFEATURE3 0x0C /* READ: Hardware Feature Byte 3 */ | 73 | #define VPD_HWFEATURE3 0x0C /* READ: Hardware Feature Byte 3 */ |
74 | #define VPD_HWFEATURE4 0x0D /* READ: Hardware Feature Byte 4 */ | 74 | #define VPD_HWFEATURE4 0x0D /* READ: Hardware Feature Byte 4 */ |
75 | #define VPD_HWFEATURE5 0x0E /* READ: Hardware Feature Byte 5 */ | 75 | #define VPD_HWFEATURE5 0x0E /* READ: Hardware Feature Byte 5 */ |
76 | #define VPD_OEMID 0x0F /* READ: OEM Identifier */ | 76 | #define VPD_OEMID 0x0F /* READ: OEM Identifier */ |
77 | #define VPD_IDENT 0x10 /* READ: Identifier string (16 bytes) */ | 77 | #define VPD_IDENT 0x10 /* READ: Identifier string (16 bytes) */ |
78 | #define VPD_IDENT_LEN 0x10 | 78 | #define VPD_IDENT_LEN 0x10 |
79 | 79 | ||
80 | /* VPD ROM Definitions... */ | 80 | /* VPD ROM Definitions... */ |
81 | #define SLX_ID1 0x4D | 81 | #define SLX_ID1 0x4D |
82 | #define SLX_ID2 0x98 | 82 | #define SLX_ID2 0x98 |
83 | 83 | ||
84 | #define PRODUCT_ID(a) ((a>>4)&0xF) /* Use to obtain Product ID from VPD_UNIQUEID1 */ | 84 | #define PRODUCT_ID(a) ((a>>4)&0xF) /* Use to obtain Product ID from VPD_UNIQUEID1 */ |
85 | 85 | ||
86 | #define ID_SX_ISA 0x2 | 86 | #define ID_SX_ISA 0x2 |
87 | #define ID_RIO_EISA 0x3 | 87 | #define ID_RIO_EISA 0x3 |
@@ -101,7 +101,7 @@ | |||
101 | 101 | ||
102 | /* Firmware load position... */ | 102 | /* Firmware load position... */ |
103 | 103 | ||
104 | #define FIRMWARELOADADDR 0x7C00 /* Firmware is loaded _before_ this address */ | 104 | #define FIRMWARELOADADDR 0x7C00 /* Firmware is loaded _before_ this address */ |
105 | 105 | ||
106 | /***************************************************************************** | 106 | /***************************************************************************** |
107 | ***************************** ***************************** | 107 | ***************************** ***************************** |
@@ -112,14 +112,14 @@ | |||
112 | /* Control Register Definitions... */ | 112 | /* Control Register Definitions... */ |
113 | #define RIO_ISA_IDENT "JBJGPGGHINSMJPJR" | 113 | #define RIO_ISA_IDENT "JBJGPGGHINSMJPJR" |
114 | 114 | ||
115 | #define RIO_ISA_CFG_BOOTRAM 0x01 /* Boot from RAM, else Link */ | 115 | #define RIO_ISA_CFG_BOOTRAM 0x01 /* Boot from RAM, else Link */ |
116 | #define RIO_ISA_CFG_BUSENABLE 0x02 /* Enable processor bus */ | 116 | #define RIO_ISA_CFG_BUSENABLE 0x02 /* Enable processor bus */ |
117 | #define RIO_ISA_CFG_IRQMASK 0x30 /* Interrupt mask */ | 117 | #define RIO_ISA_CFG_IRQMASK 0x30 /* Interrupt mask */ |
118 | #define RIO_ISA_CFG_IRQ12 0x10 /* Interrupt Level 12 */ | 118 | #define RIO_ISA_CFG_IRQ12 0x10 /* Interrupt Level 12 */ |
119 | #define RIO_ISA_CFG_IRQ11 0x20 /* Interrupt Level 11 */ | 119 | #define RIO_ISA_CFG_IRQ11 0x20 /* Interrupt Level 11 */ |
120 | #define RIO_ISA_CFG_IRQ9 0x30 /* Interrupt Level 9 */ | 120 | #define RIO_ISA_CFG_IRQ9 0x30 /* Interrupt Level 9 */ |
121 | #define RIO_ISA_CFG_LINK20 0x40 /* 20Mbps link, else 10Mbps */ | 121 | #define RIO_ISA_CFG_LINK20 0x40 /* 20Mbps link, else 10Mbps */ |
122 | #define RIO_ISA_CFG_WAITSTATE0 0x80 /* 0 waitstates, else 1 */ | 122 | #define RIO_ISA_CFG_WAITSTATE0 0x80 /* 0 waitstates, else 1 */ |
123 | 123 | ||
124 | /***************************************************************************** | 124 | /***************************************************************************** |
125 | ***************************** ***************************** | 125 | ***************************** ***************************** |
@@ -130,17 +130,17 @@ | |||
130 | /* Control Register Definitions... */ | 130 | /* Control Register Definitions... */ |
131 | #define RIO_ISA2_IDENT "JBJGPGGHINSMJPJR" | 131 | #define RIO_ISA2_IDENT "JBJGPGGHINSMJPJR" |
132 | 132 | ||
133 | #define RIO_ISA2_CFG_BOOTRAM 0x01 /* Boot from RAM, else Link */ | 133 | #define RIO_ISA2_CFG_BOOTRAM 0x01 /* Boot from RAM, else Link */ |
134 | #define RIO_ISA2_CFG_BUSENABLE 0x02 /* Enable processor bus */ | 134 | #define RIO_ISA2_CFG_BUSENABLE 0x02 /* Enable processor bus */ |
135 | #define RIO_ISA2_CFG_INTENABLE 0x04 /* Interrupt enable, else disable */ | 135 | #define RIO_ISA2_CFG_INTENABLE 0x04 /* Interrupt enable, else disable */ |
136 | #define RIO_ISA2_CFG_16BIT 0x08 /* 16bit mode, else 8bit */ | 136 | #define RIO_ISA2_CFG_16BIT 0x08 /* 16bit mode, else 8bit */ |
137 | #define RIO_ISA2_CFG_IRQMASK 0x30 /* Interrupt mask */ | 137 | #define RIO_ISA2_CFG_IRQMASK 0x30 /* Interrupt mask */ |
138 | #define RIO_ISA2_CFG_IRQ15 0x00 /* Interrupt Level 15 */ | 138 | #define RIO_ISA2_CFG_IRQ15 0x00 /* Interrupt Level 15 */ |
139 | #define RIO_ISA2_CFG_IRQ12 0x10 /* Interrupt Level 12 */ | 139 | #define RIO_ISA2_CFG_IRQ12 0x10 /* Interrupt Level 12 */ |
140 | #define RIO_ISA2_CFG_IRQ11 0x20 /* Interrupt Level 11 */ | 140 | #define RIO_ISA2_CFG_IRQ11 0x20 /* Interrupt Level 11 */ |
141 | #define RIO_ISA2_CFG_IRQ9 0x30 /* Interrupt Level 9 */ | 141 | #define RIO_ISA2_CFG_IRQ9 0x30 /* Interrupt Level 9 */ |
142 | #define RIO_ISA2_CFG_LINK20 0x40 /* 20Mbps link, else 10Mbps */ | 142 | #define RIO_ISA2_CFG_LINK20 0x40 /* 20Mbps link, else 10Mbps */ |
143 | #define RIO_ISA2_CFG_WAITSTATE0 0x80 /* 0 waitstates, else 1 */ | 143 | #define RIO_ISA2_CFG_WAITSTATE0 0x80 /* 0 waitstates, else 1 */ |
144 | 144 | ||
145 | /***************************************************************************** | 145 | /***************************************************************************** |
146 | ***************************** ****************************** | 146 | ***************************** ****************************** |
@@ -151,14 +151,14 @@ | |||
151 | /* Control Register Definitions... */ | 151 | /* Control Register Definitions... */ |
152 | #define RIO_ISA3_IDENT "JET HOST BY KEV#" | 152 | #define RIO_ISA3_IDENT "JET HOST BY KEV#" |
153 | 153 | ||
154 | #define RIO_ISA3_CFG_BUSENABLE 0x02 /* Enable processor bus */ | 154 | #define RIO_ISA3_CFG_BUSENABLE 0x02 /* Enable processor bus */ |
155 | #define RIO_ISA3_CFG_INTENABLE 0x04 /* Interrupt enable, else disable */ | 155 | #define RIO_ISA3_CFG_INTENABLE 0x04 /* Interrupt enable, else disable */ |
156 | #define RIO_ISA32_CFG_IRQMASK 0xF30 /* Interrupt mask */ | 156 | #define RIO_ISA32_CFG_IRQMASK 0xF30 /* Interrupt mask */ |
157 | #define RIO_ISA3_CFG_IRQ15 0xF0 /* Interrupt Level 15 */ | 157 | #define RIO_ISA3_CFG_IRQ15 0xF0 /* Interrupt Level 15 */ |
158 | #define RIO_ISA3_CFG_IRQ12 0xC0 /* Interrupt Level 12 */ | 158 | #define RIO_ISA3_CFG_IRQ12 0xC0 /* Interrupt Level 12 */ |
159 | #define RIO_ISA3_CFG_IRQ11 0xB0 /* Interrupt Level 11 */ | 159 | #define RIO_ISA3_CFG_IRQ11 0xB0 /* Interrupt Level 11 */ |
160 | #define RIO_ISA3_CFG_IRQ10 0xA0 /* Interrupt Level 10 */ | 160 | #define RIO_ISA3_CFG_IRQ10 0xA0 /* Interrupt Level 10 */ |
161 | #define RIO_ISA3_CFG_IRQ9 0x90 /* Interrupt Level 9 */ | 161 | #define RIO_ISA3_CFG_IRQ9 0x90 /* Interrupt Level 9 */ |
162 | 162 | ||
163 | /***************************************************************************** | 163 | /***************************************************************************** |
164 | ********************************* ******************************** | 164 | ********************************* ******************************** |
@@ -169,9 +169,9 @@ | |||
169 | /* Control Register Definitions... */ | 169 | /* Control Register Definitions... */ |
170 | #define RIO_MCA_IDENT "JBJGPGGHINSMJPJR" | 170 | #define RIO_MCA_IDENT "JBJGPGGHINSMJPJR" |
171 | 171 | ||
172 | #define RIO_MCA_CFG_BOOTRAM 0x01 /* Boot from RAM, else Link */ | 172 | #define RIO_MCA_CFG_BOOTRAM 0x01 /* Boot from RAM, else Link */ |
173 | #define RIO_MCA_CFG_BUSENABLE 0x02 /* Enable processor bus */ | 173 | #define RIO_MCA_CFG_BUSENABLE 0x02 /* Enable processor bus */ |
174 | #define RIO_MCA_CFG_LINK20 0x40 /* 20Mbps link, else 10Mbps */ | 174 | #define RIO_MCA_CFG_LINK20 0x40 /* 20Mbps link, else 10Mbps */ |
175 | 175 | ||
176 | /***************************************************************************** | 176 | /***************************************************************************** |
177 | ******************************** ******************************** | 177 | ******************************** ******************************** |
@@ -185,35 +185,35 @@ | |||
185 | #define EISA_PRODUCT_NUMBER 0xC82 | 185 | #define EISA_PRODUCT_NUMBER 0xC82 |
186 | #define EISA_REVISION_NUMBER 0xC83 | 186 | #define EISA_REVISION_NUMBER 0xC83 |
187 | #define EISA_CARD_ENABLE 0xC84 | 187 | #define EISA_CARD_ENABLE 0xC84 |
188 | #define EISA_VPD_UNIQUEID4 0xC88 /* READ: Unique Identifier #4 */ | 188 | #define EISA_VPD_UNIQUEID4 0xC88 /* READ: Unique Identifier #4 */ |
189 | #define EISA_VPD_UNIQUEID3 0xC8A /* READ: Unique Identifier #3 */ | 189 | #define EISA_VPD_UNIQUEID3 0xC8A /* READ: Unique Identifier #3 */ |
190 | #define EISA_VPD_UNIQUEID2 0xC90 /* READ: Unique Identifier #2 */ | 190 | #define EISA_VPD_UNIQUEID2 0xC90 /* READ: Unique Identifier #2 */ |
191 | #define EISA_VPD_UNIQUEID1 0xC92 /* READ: Unique Identifier #1 */ | 191 | #define EISA_VPD_UNIQUEID1 0xC92 /* READ: Unique Identifier #1 */ |
192 | #define EISA_VPD_MANU_YEAR 0xC98 /* READ: Year Of Manufacture (0 = 1970) */ | 192 | #define EISA_VPD_MANU_YEAR 0xC98 /* READ: Year Of Manufacture (0 = 1970) */ |
193 | #define EISA_VPD_MANU_WEEK 0xC9A /* READ: Week Of Manufacture (0 = week 1 Jan) */ | 193 | #define EISA_VPD_MANU_WEEK 0xC9A /* READ: Week Of Manufacture (0 = week 1 Jan) */ |
194 | #define EISA_MEM_ADDR_23_16 0xC00 | 194 | #define EISA_MEM_ADDR_23_16 0xC00 |
195 | #define EISA_MEM_ADDR_31_24 0xC01 | 195 | #define EISA_MEM_ADDR_31_24 0xC01 |
196 | #define EISA_RIO_CONFIG 0xC02 /* WRITE: Configuration Register */ | 196 | #define EISA_RIO_CONFIG 0xC02 /* WRITE: Configuration Register */ |
197 | #define EISA_RIO_INTSET 0xC03 /* WRITE: Interrupt Set */ | 197 | #define EISA_RIO_INTSET 0xC03 /* WRITE: Interrupt Set */ |
198 | #define EISA_RIO_INTRESET 0xC03 /* READ: Interrupt Reset */ | 198 | #define EISA_RIO_INTRESET 0xC03 /* READ: Interrupt Reset */ |
199 | 199 | ||
200 | /* Control Register Definitions... */ | 200 | /* Control Register Definitions... */ |
201 | #define RIO_EISA_CFG_BOOTRAM 0x01 /* Boot from RAM, else Link */ | 201 | #define RIO_EISA_CFG_BOOTRAM 0x01 /* Boot from RAM, else Link */ |
202 | #define RIO_EISA_CFG_LINK20 0x02 /* 20Mbps link, else 10Mbps */ | 202 | #define RIO_EISA_CFG_LINK20 0x02 /* 20Mbps link, else 10Mbps */ |
203 | #define RIO_EISA_CFG_BUSENABLE 0x04 /* Enable processor bus */ | 203 | #define RIO_EISA_CFG_BUSENABLE 0x04 /* Enable processor bus */ |
204 | #define RIO_EISA_CFG_PROCRUN 0x08 /* Processor running, else reset */ | 204 | #define RIO_EISA_CFG_PROCRUN 0x08 /* Processor running, else reset */ |
205 | #define RIO_EISA_CFG_IRQMASK 0xF0 /* Interrupt mask */ | 205 | #define RIO_EISA_CFG_IRQMASK 0xF0 /* Interrupt mask */ |
206 | #define RIO_EISA_CFG_IRQ15 0xF0 /* Interrupt Level 15 */ | 206 | #define RIO_EISA_CFG_IRQ15 0xF0 /* Interrupt Level 15 */ |
207 | #define RIO_EISA_CFG_IRQ14 0xE0 /* Interrupt Level 14 */ | 207 | #define RIO_EISA_CFG_IRQ14 0xE0 /* Interrupt Level 14 */ |
208 | #define RIO_EISA_CFG_IRQ12 0xC0 /* Interrupt Level 12 */ | 208 | #define RIO_EISA_CFG_IRQ12 0xC0 /* Interrupt Level 12 */ |
209 | #define RIO_EISA_CFG_IRQ11 0xB0 /* Interrupt Level 11 */ | 209 | #define RIO_EISA_CFG_IRQ11 0xB0 /* Interrupt Level 11 */ |
210 | #define RIO_EISA_CFG_IRQ10 0xA0 /* Interrupt Level 10 */ | 210 | #define RIO_EISA_CFG_IRQ10 0xA0 /* Interrupt Level 10 */ |
211 | #define RIO_EISA_CFG_IRQ9 0x90 /* Interrupt Level 9 */ | 211 | #define RIO_EISA_CFG_IRQ9 0x90 /* Interrupt Level 9 */ |
212 | #define RIO_EISA_CFG_IRQ7 0x70 /* Interrupt Level 7 */ | 212 | #define RIO_EISA_CFG_IRQ7 0x70 /* Interrupt Level 7 */ |
213 | #define RIO_EISA_CFG_IRQ6 0x60 /* Interrupt Level 6 */ | 213 | #define RIO_EISA_CFG_IRQ6 0x60 /* Interrupt Level 6 */ |
214 | #define RIO_EISA_CFG_IRQ5 0x50 /* Interrupt Level 5 */ | 214 | #define RIO_EISA_CFG_IRQ5 0x50 /* Interrupt Level 5 */ |
215 | #define RIO_EISA_CFG_IRQ4 0x40 /* Interrupt Level 4 */ | 215 | #define RIO_EISA_CFG_IRQ4 0x40 /* Interrupt Level 4 */ |
216 | #define RIO_EISA_CFG_IRQ3 0x30 /* Interrupt Level 3 */ | 216 | #define RIO_EISA_CFG_IRQ3 0x30 /* Interrupt Level 3 */ |
217 | 217 | ||
218 | /***************************************************************************** | 218 | /***************************************************************************** |
219 | ******************************** ******************************** | 219 | ******************************** ******************************** |
@@ -224,20 +224,20 @@ | |||
224 | /* Control Register Definitions... */ | 224 | /* Control Register Definitions... */ |
225 | #define RIO_SBUS_IDENT "JBPGK#\0\0\0\0\0\0\0\0\0\0" | 225 | #define RIO_SBUS_IDENT "JBPGK#\0\0\0\0\0\0\0\0\0\0" |
226 | 226 | ||
227 | #define RIO_SBUS_CFG_BOOTRAM 0x01 /* Boot from RAM, else Link */ | 227 | #define RIO_SBUS_CFG_BOOTRAM 0x01 /* Boot from RAM, else Link */ |
228 | #define RIO_SBUS_CFG_BUSENABLE 0x02 /* Enable processor bus */ | 228 | #define RIO_SBUS_CFG_BUSENABLE 0x02 /* Enable processor bus */ |
229 | #define RIO_SBUS_CFG_INTENABLE 0x04 /* Interrupt enable, else disable */ | 229 | #define RIO_SBUS_CFG_INTENABLE 0x04 /* Interrupt enable, else disable */ |
230 | #define RIO_SBUS_CFG_IRQMASK 0x38 /* Interrupt mask */ | 230 | #define RIO_SBUS_CFG_IRQMASK 0x38 /* Interrupt mask */ |
231 | #define RIO_SBUS_CFG_IRQNONE 0x00 /* No Interrupt */ | 231 | #define RIO_SBUS_CFG_IRQNONE 0x00 /* No Interrupt */ |
232 | #define RIO_SBUS_CFG_IRQ7 0x38 /* Interrupt Level 7 */ | 232 | #define RIO_SBUS_CFG_IRQ7 0x38 /* Interrupt Level 7 */ |
233 | #define RIO_SBUS_CFG_IRQ6 0x30 /* Interrupt Level 6 */ | 233 | #define RIO_SBUS_CFG_IRQ6 0x30 /* Interrupt Level 6 */ |
234 | #define RIO_SBUS_CFG_IRQ5 0x28 /* Interrupt Level 5 */ | 234 | #define RIO_SBUS_CFG_IRQ5 0x28 /* Interrupt Level 5 */ |
235 | #define RIO_SBUS_CFG_IRQ4 0x20 /* Interrupt Level 4 */ | 235 | #define RIO_SBUS_CFG_IRQ4 0x20 /* Interrupt Level 4 */ |
236 | #define RIO_SBUS_CFG_IRQ3 0x18 /* Interrupt Level 3 */ | 236 | #define RIO_SBUS_CFG_IRQ3 0x18 /* Interrupt Level 3 */ |
237 | #define RIO_SBUS_CFG_IRQ2 0x10 /* Interrupt Level 2 */ | 237 | #define RIO_SBUS_CFG_IRQ2 0x10 /* Interrupt Level 2 */ |
238 | #define RIO_SBUS_CFG_IRQ1 0x08 /* Interrupt Level 1 */ | 238 | #define RIO_SBUS_CFG_IRQ1 0x08 /* Interrupt Level 1 */ |
239 | #define RIO_SBUS_CFG_LINK20 0x40 /* 20Mbps link, else 10Mbps */ | 239 | #define RIO_SBUS_CFG_LINK20 0x40 /* 20Mbps link, else 10Mbps */ |
240 | #define RIO_SBUS_CFG_PROC25 0x80 /* 25Mhz processor clock, else 20Mhz */ | 240 | #define RIO_SBUS_CFG_PROC25 0x80 /* 25Mhz processor clock, else 20Mhz */ |
241 | 241 | ||
242 | /***************************************************************************** | 242 | /***************************************************************************** |
243 | ********************************* ******************************** | 243 | ********************************* ******************************** |
@@ -248,18 +248,18 @@ | |||
248 | /* Control Register Definitions... */ | 248 | /* Control Register Definitions... */ |
249 | #define RIO_PCI_IDENT "ECDDPGJGJHJRGSK#" | 249 | #define RIO_PCI_IDENT "ECDDPGJGJHJRGSK#" |
250 | 250 | ||
251 | #define RIO_PCI_CFG_BOOTRAM 0x01 /* Boot from RAM, else Link */ | 251 | #define RIO_PCI_CFG_BOOTRAM 0x01 /* Boot from RAM, else Link */ |
252 | #define RIO_PCI_CFG_BUSENABLE 0x02 /* Enable processor bus */ | 252 | #define RIO_PCI_CFG_BUSENABLE 0x02 /* Enable processor bus */ |
253 | #define RIO_PCI_CFG_INTENABLE 0x04 /* Interrupt enable, else disable */ | 253 | #define RIO_PCI_CFG_INTENABLE 0x04 /* Interrupt enable, else disable */ |
254 | #define RIO_PCI_CFG_LINK20 0x40 /* 20Mbps link, else 10Mbps */ | 254 | #define RIO_PCI_CFG_LINK20 0x40 /* 20Mbps link, else 10Mbps */ |
255 | #define RIO_PCI_CFG_PROC25 0x80 /* 25Mhz processor clock, else 20Mhz */ | 255 | #define RIO_PCI_CFG_PROC25 0x80 /* 25Mhz processor clock, else 20Mhz */ |
256 | 256 | ||
257 | /* PCI Definitions... */ | 257 | /* PCI Definitions... */ |
258 | #define SPX_VENDOR_ID 0x11CB /* Assigned by the PCI SIG */ | 258 | #define SPX_VENDOR_ID 0x11CB /* Assigned by the PCI SIG */ |
259 | #define SPX_DEVICE_ID 0x8000 /* RIO bridge boards */ | 259 | #define SPX_DEVICE_ID 0x8000 /* RIO bridge boards */ |
260 | #define SPX_PLXDEVICE_ID 0x2000 /* PLX bridge boards */ | 260 | #define SPX_PLXDEVICE_ID 0x2000 /* PLX bridge boards */ |
261 | #define SPX_SUB_VENDOR_ID SPX_VENDOR_ID /* Same as vendor id */ | 261 | #define SPX_SUB_VENDOR_ID SPX_VENDOR_ID /* Same as vendor id */ |
262 | #define RIO_SUB_SYS_ID 0x0800 /* RIO PCI board */ | 262 | #define RIO_SUB_SYS_ID 0x0800 /* RIO PCI board */ |
263 | 263 | ||
264 | /***************************************************************************** | 264 | /***************************************************************************** |
265 | ***************************** ****************************** | 265 | ***************************** ****************************** |
@@ -270,11 +270,11 @@ | |||
270 | /* Control Register Definitions... */ | 270 | /* Control Register Definitions... */ |
271 | #define RIO_PCI2_IDENT "JET HOST BY KEV#" | 271 | #define RIO_PCI2_IDENT "JET HOST BY KEV#" |
272 | 272 | ||
273 | #define RIO_PCI2_CFG_BUSENABLE 0x02 /* Enable processor bus */ | 273 | #define RIO_PCI2_CFG_BUSENABLE 0x02 /* Enable processor bus */ |
274 | #define RIO_PCI2_CFG_INTENABLE 0x04 /* Interrupt enable, else disable */ | 274 | #define RIO_PCI2_CFG_INTENABLE 0x04 /* Interrupt enable, else disable */ |
275 | 275 | ||
276 | /* PCI Definitions... */ | 276 | /* PCI Definitions... */ |
277 | #define RIO2_SUB_SYS_ID 0x0100 /* RIO (Jet) PCI board */ | 277 | #define RIO2_SUB_SYS_ID 0x0100 /* RIO (Jet) PCI board */ |
278 | 278 | ||
279 | #endif /*_rioboard_h */ | 279 | #endif /*_rioboard_h */ |
280 | 280 | ||
diff --git a/drivers/char/rio/riocmd.c b/drivers/char/rio/riocmd.c index 533085ec6f1b..b97dd9fdb6ba 100644 --- a/drivers/char/rio/riocmd.c +++ b/drivers/char/rio/riocmd.c | |||
@@ -83,102 +83,98 @@ static char *_riocmd_c_sccs_ = "@(#)riocmd.c 1.2"; | |||
83 | static struct IdentifyRta IdRta; | 83 | static struct IdentifyRta IdRta; |
84 | static struct KillNeighbour KillUnit; | 84 | static struct KillNeighbour KillUnit; |
85 | 85 | ||
86 | int | 86 | int RIOFoadRta(struct Host *HostP, struct Map *MapP) |
87 | RIOFoadRta(struct Host *HostP, struct Map *MapP) | ||
88 | { | 87 | { |
89 | struct CmdBlk *CmdBlkP; | 88 | struct CmdBlk *CmdBlkP; |
90 | 89 | ||
91 | rio_dprintk (RIO_DEBUG_CMD, "FOAD RTA\n"); | 90 | rio_dprintk(RIO_DEBUG_CMD, "FOAD RTA\n"); |
92 | 91 | ||
93 | CmdBlkP = RIOGetCmdBlk(); | 92 | CmdBlkP = RIOGetCmdBlk(); |
94 | 93 | ||
95 | if ( !CmdBlkP ) { | 94 | if (!CmdBlkP) { |
96 | rio_dprintk (RIO_DEBUG_CMD, "FOAD RTA: GetCmdBlk failed\n"); | 95 | rio_dprintk(RIO_DEBUG_CMD, "FOAD RTA: GetCmdBlk failed\n"); |
97 | return -ENXIO; | 96 | return -ENXIO; |
98 | } | 97 | } |
99 | 98 | ||
100 | CmdBlkP->Packet.dest_unit = MapP->ID; | 99 | CmdBlkP->Packet.dest_unit = MapP->ID; |
101 | CmdBlkP->Packet.dest_port = BOOT_RUP; | 100 | CmdBlkP->Packet.dest_port = BOOT_RUP; |
102 | CmdBlkP->Packet.src_unit = 0; | 101 | CmdBlkP->Packet.src_unit = 0; |
103 | CmdBlkP->Packet.src_port = BOOT_RUP; | 102 | CmdBlkP->Packet.src_port = BOOT_RUP; |
104 | CmdBlkP->Packet.len = 0x84; | 103 | CmdBlkP->Packet.len = 0x84; |
105 | CmdBlkP->Packet.data[0] = IFOAD; | 104 | CmdBlkP->Packet.data[0] = IFOAD; |
106 | CmdBlkP->Packet.data[1] = 0; | 105 | CmdBlkP->Packet.data[1] = 0; |
107 | CmdBlkP->Packet.data[2] = IFOAD_MAGIC & 0xFF; | 106 | CmdBlkP->Packet.data[2] = IFOAD_MAGIC & 0xFF; |
108 | CmdBlkP->Packet.data[3] = (IFOAD_MAGIC >> 8) & 0xFF; | 107 | CmdBlkP->Packet.data[3] = (IFOAD_MAGIC >> 8) & 0xFF; |
109 | 108 | ||
110 | if ( RIOQueueCmdBlk( HostP, MapP->ID-1, CmdBlkP) == RIO_FAIL ) { | 109 | if (RIOQueueCmdBlk(HostP, MapP->ID - 1, CmdBlkP) == RIO_FAIL) { |
111 | rio_dprintk (RIO_DEBUG_CMD, "FOAD RTA: Failed to queue foad command\n"); | 110 | rio_dprintk(RIO_DEBUG_CMD, "FOAD RTA: Failed to queue foad command\n"); |
112 | return -EIO; | 111 | return -EIO; |
113 | } | 112 | } |
114 | return 0; | 113 | return 0; |
115 | } | 114 | } |
116 | 115 | ||
117 | int | 116 | int RIOZombieRta(struct Host *HostP, struct Map *MapP) |
118 | RIOZombieRta(struct Host *HostP, struct Map *MapP) | ||
119 | { | 117 | { |
120 | struct CmdBlk *CmdBlkP; | 118 | struct CmdBlk *CmdBlkP; |
121 | 119 | ||
122 | rio_dprintk (RIO_DEBUG_CMD, "ZOMBIE RTA\n"); | 120 | rio_dprintk(RIO_DEBUG_CMD, "ZOMBIE RTA\n"); |
123 | 121 | ||
124 | CmdBlkP = RIOGetCmdBlk(); | 122 | CmdBlkP = RIOGetCmdBlk(); |
125 | 123 | ||
126 | if ( !CmdBlkP ) { | 124 | if (!CmdBlkP) { |
127 | rio_dprintk (RIO_DEBUG_CMD, "ZOMBIE RTA: GetCmdBlk failed\n"); | 125 | rio_dprintk(RIO_DEBUG_CMD, "ZOMBIE RTA: GetCmdBlk failed\n"); |
128 | return -ENXIO; | 126 | return -ENXIO; |
129 | } | 127 | } |
130 | 128 | ||
131 | CmdBlkP->Packet.dest_unit = MapP->ID; | 129 | CmdBlkP->Packet.dest_unit = MapP->ID; |
132 | CmdBlkP->Packet.dest_port = BOOT_RUP; | 130 | CmdBlkP->Packet.dest_port = BOOT_RUP; |
133 | CmdBlkP->Packet.src_unit = 0; | 131 | CmdBlkP->Packet.src_unit = 0; |
134 | CmdBlkP->Packet.src_port = BOOT_RUP; | 132 | CmdBlkP->Packet.src_port = BOOT_RUP; |
135 | CmdBlkP->Packet.len = 0x84; | 133 | CmdBlkP->Packet.len = 0x84; |
136 | CmdBlkP->Packet.data[0] = ZOMBIE; | 134 | CmdBlkP->Packet.data[0] = ZOMBIE; |
137 | CmdBlkP->Packet.data[1] = 0; | 135 | CmdBlkP->Packet.data[1] = 0; |
138 | CmdBlkP->Packet.data[2] = ZOMBIE_MAGIC & 0xFF; | 136 | CmdBlkP->Packet.data[2] = ZOMBIE_MAGIC & 0xFF; |
139 | CmdBlkP->Packet.data[3] = (ZOMBIE_MAGIC >> 8) & 0xFF; | 137 | CmdBlkP->Packet.data[3] = (ZOMBIE_MAGIC >> 8) & 0xFF; |
140 | 138 | ||
141 | if ( RIOQueueCmdBlk( HostP, MapP->ID-1, CmdBlkP) == RIO_FAIL ) { | 139 | if (RIOQueueCmdBlk(HostP, MapP->ID - 1, CmdBlkP) == RIO_FAIL) { |
142 | rio_dprintk (RIO_DEBUG_CMD, "ZOMBIE RTA: Failed to queue zombie command\n"); | 140 | rio_dprintk(RIO_DEBUG_CMD, "ZOMBIE RTA: Failed to queue zombie command\n"); |
143 | return -EIO; | 141 | return -EIO; |
144 | } | 142 | } |
145 | return 0; | 143 | return 0; |
146 | } | 144 | } |
147 | 145 | ||
148 | int | 146 | int RIOCommandRta(struct rio_info *p, uint RtaUnique, int (*func) (struct Host * HostP, struct Map * MapP)) |
149 | RIOCommandRta(struct rio_info *p, uint RtaUnique, | ||
150 | int (* func)(struct Host *HostP, struct Map *MapP)) | ||
151 | { | 147 | { |
152 | uint Host; | 148 | uint Host; |
153 | 149 | ||
154 | rio_dprintk (RIO_DEBUG_CMD, "Command RTA 0x%x func 0x%x\n", RtaUnique, (int)func); | 150 | rio_dprintk(RIO_DEBUG_CMD, "Command RTA 0x%x func 0x%x\n", RtaUnique, (int) func); |
155 | 151 | ||
156 | if ( !RtaUnique ) | 152 | if (!RtaUnique) |
157 | return(0); | 153 | return (0); |
158 | 154 | ||
159 | for ( Host = 0; Host < p->RIONumHosts; Host++ ) { | 155 | for (Host = 0; Host < p->RIONumHosts; Host++) { |
160 | uint Rta; | 156 | uint Rta; |
161 | struct Host *HostP = &p->RIOHosts[Host]; | 157 | struct Host *HostP = &p->RIOHosts[Host]; |
162 | 158 | ||
163 | for ( Rta = 0; Rta < RTAS_PER_HOST; Rta++ ) { | 159 | for (Rta = 0; Rta < RTAS_PER_HOST; Rta++) { |
164 | struct Map *MapP = &HostP->Mapping[Rta]; | 160 | struct Map *MapP = &HostP->Mapping[Rta]; |
165 | 161 | ||
166 | if ( MapP->RtaUniqueNum == RtaUnique ) { | 162 | if (MapP->RtaUniqueNum == RtaUnique) { |
167 | uint Link; | 163 | uint Link; |
168 | 164 | ||
169 | /* | 165 | /* |
170 | ** now, lets just check we have a route to it... | 166 | ** now, lets just check we have a route to it... |
171 | ** IF the routing stuff is working, then one of the | 167 | ** IF the routing stuff is working, then one of the |
172 | ** topology entries for this unit will have a legit | 168 | ** topology entries for this unit will have a legit |
173 | ** route *somewhere*. We care not where - if its got | 169 | ** route *somewhere*. We care not where - if its got |
174 | ** any connections, we can get to it. | 170 | ** any connections, we can get to it. |
175 | */ | 171 | */ |
176 | for ( Link = 0; Link < LINKS_PER_UNIT; Link++ ) { | 172 | for (Link = 0; Link < LINKS_PER_UNIT; Link++) { |
177 | if ( MapP->Topology[Link].Unit <= (uchar)MAX_RUP ) { | 173 | if (MapP->Topology[Link].Unit <= (uchar) MAX_RUP) { |
178 | /* | 174 | /* |
179 | ** Its worth trying the operation... | 175 | ** Its worth trying the operation... |
180 | */ | 176 | */ |
181 | return (*func)( HostP, MapP ); | 177 | return (*func) (HostP, MapP); |
182 | } | 178 | } |
183 | } | 179 | } |
184 | } | 180 | } |
@@ -188,60 +184,59 @@ RIOCommandRta(struct rio_info *p, uint RtaUnique, | |||
188 | } | 184 | } |
189 | 185 | ||
190 | 186 | ||
191 | int | 187 | int RIOIdentifyRta(struct rio_info *p, caddr_t arg) |
192 | RIOIdentifyRta(struct rio_info *p, caddr_t arg) | ||
193 | { | 188 | { |
194 | uint Host; | 189 | uint Host; |
195 | 190 | ||
196 | if ( copyin( (int)arg, (caddr_t)&IdRta, sizeof(IdRta) ) == COPYFAIL ) { | 191 | if (copyin((int) arg, (caddr_t) & IdRta, sizeof(IdRta)) == COPYFAIL) { |
197 | rio_dprintk (RIO_DEBUG_CMD, "RIO_IDENTIFY_RTA copy failed\n"); | 192 | rio_dprintk(RIO_DEBUG_CMD, "RIO_IDENTIFY_RTA copy failed\n"); |
198 | p->RIOError.Error = COPYIN_FAILED; | 193 | p->RIOError.Error = COPYIN_FAILED; |
199 | return -EFAULT; | 194 | return -EFAULT; |
200 | } | 195 | } |
201 | 196 | ||
202 | for ( Host = 0 ; Host < p->RIONumHosts; Host++ ) { | 197 | for (Host = 0; Host < p->RIONumHosts; Host++) { |
203 | uint Rta; | 198 | uint Rta; |
204 | struct Host *HostP = &p->RIOHosts[Host]; | 199 | struct Host *HostP = &p->RIOHosts[Host]; |
205 | 200 | ||
206 | for ( Rta = 0; Rta < RTAS_PER_HOST; Rta++ ) { | 201 | for (Rta = 0; Rta < RTAS_PER_HOST; Rta++) { |
207 | struct Map *MapP = &HostP->Mapping[Rta]; | 202 | struct Map *MapP = &HostP->Mapping[Rta]; |
208 | 203 | ||
209 | if ( MapP->RtaUniqueNum == IdRta.RtaUnique ) { | 204 | if (MapP->RtaUniqueNum == IdRta.RtaUnique) { |
210 | uint Link; | 205 | uint Link; |
211 | /* | 206 | /* |
212 | ** now, lets just check we have a route to it... | 207 | ** now, lets just check we have a route to it... |
213 | ** IF the routing stuff is working, then one of the | 208 | ** IF the routing stuff is working, then one of the |
214 | ** topology entries for this unit will have a legit | 209 | ** topology entries for this unit will have a legit |
215 | ** route *somewhere*. We care not where - if its got | 210 | ** route *somewhere*. We care not where - if its got |
216 | ** any connections, we can get to it. | 211 | ** any connections, we can get to it. |
217 | */ | 212 | */ |
218 | for ( Link = 0; Link < LINKS_PER_UNIT; Link++ ) { | 213 | for (Link = 0; Link < LINKS_PER_UNIT; Link++) { |
219 | if ( MapP->Topology[Link].Unit <= (uchar)MAX_RUP ) { | 214 | if (MapP->Topology[Link].Unit <= (uchar) MAX_RUP) { |
220 | /* | 215 | /* |
221 | ** Its worth trying the operation... | 216 | ** Its worth trying the operation... |
222 | */ | 217 | */ |
223 | struct CmdBlk *CmdBlkP; | 218 | struct CmdBlk *CmdBlkP; |
224 | 219 | ||
225 | rio_dprintk (RIO_DEBUG_CMD, "IDENTIFY RTA\n"); | 220 | rio_dprintk(RIO_DEBUG_CMD, "IDENTIFY RTA\n"); |
226 | 221 | ||
227 | CmdBlkP = RIOGetCmdBlk(); | 222 | CmdBlkP = RIOGetCmdBlk(); |
228 | 223 | ||
229 | if ( !CmdBlkP ) { | 224 | if (!CmdBlkP) { |
230 | rio_dprintk (RIO_DEBUG_CMD, "IDENTIFY RTA: GetCmdBlk failed\n"); | 225 | rio_dprintk(RIO_DEBUG_CMD, "IDENTIFY RTA: GetCmdBlk failed\n"); |
231 | return -ENXIO; | 226 | return -ENXIO; |
232 | } | 227 | } |
233 | 228 | ||
234 | CmdBlkP->Packet.dest_unit = MapP->ID; | 229 | CmdBlkP->Packet.dest_unit = MapP->ID; |
235 | CmdBlkP->Packet.dest_port = BOOT_RUP; | 230 | CmdBlkP->Packet.dest_port = BOOT_RUP; |
236 | CmdBlkP->Packet.src_unit = 0; | 231 | CmdBlkP->Packet.src_unit = 0; |
237 | CmdBlkP->Packet.src_port = BOOT_RUP; | 232 | CmdBlkP->Packet.src_port = BOOT_RUP; |
238 | CmdBlkP->Packet.len = 0x84; | 233 | CmdBlkP->Packet.len = 0x84; |
239 | CmdBlkP->Packet.data[0] = IDENTIFY; | 234 | CmdBlkP->Packet.data[0] = IDENTIFY; |
240 | CmdBlkP->Packet.data[1] = 0; | 235 | CmdBlkP->Packet.data[1] = 0; |
241 | CmdBlkP->Packet.data[2] = IdRta.ID; | 236 | CmdBlkP->Packet.data[2] = IdRta.ID; |
242 | 237 | ||
243 | if ( RIOQueueCmdBlk( HostP, MapP->ID-1, CmdBlkP) == RIO_FAIL ) { | 238 | if (RIOQueueCmdBlk(HostP, MapP->ID - 1, CmdBlkP) == RIO_FAIL) { |
244 | rio_dprintk (RIO_DEBUG_CMD, "IDENTIFY RTA: Failed to queue command\n"); | 239 | rio_dprintk(RIO_DEBUG_CMD, "IDENTIFY RTA: Failed to queue command\n"); |
245 | return -EIO; | 240 | return -EIO; |
246 | } | 241 | } |
247 | return 0; | 242 | return 0; |
@@ -249,114 +244,110 @@ RIOIdentifyRta(struct rio_info *p, caddr_t arg) | |||
249 | } | 244 | } |
250 | } | 245 | } |
251 | } | 246 | } |
252 | } | 247 | } |
253 | return -ENOENT; | 248 | return -ENOENT; |
254 | } | 249 | } |
255 | 250 | ||
256 | 251 | ||
257 | int | 252 | int RIOKillNeighbour(struct rio_info *p, caddr_t arg) |
258 | RIOKillNeighbour(struct rio_info *p, caddr_t arg) | ||
259 | { | 253 | { |
260 | uint Host; | 254 | uint Host; |
261 | uint ID; | 255 | uint ID; |
262 | struct Host *HostP; | 256 | struct Host *HostP; |
263 | struct CmdBlk *CmdBlkP; | 257 | struct CmdBlk *CmdBlkP; |
264 | 258 | ||
265 | rio_dprintk (RIO_DEBUG_CMD, "KILL HOST NEIGHBOUR\n"); | 259 | rio_dprintk(RIO_DEBUG_CMD, "KILL HOST NEIGHBOUR\n"); |
266 | 260 | ||
267 | if ( copyin( (int)arg, (caddr_t)&KillUnit, sizeof(KillUnit) ) == COPYFAIL ) { | 261 | if (copyin((int) arg, (caddr_t) & KillUnit, sizeof(KillUnit)) == COPYFAIL) { |
268 | rio_dprintk (RIO_DEBUG_CMD, "RIO_KILL_NEIGHBOUR copy failed\n"); | 262 | rio_dprintk(RIO_DEBUG_CMD, "RIO_KILL_NEIGHBOUR copy failed\n"); |
269 | p->RIOError.Error = COPYIN_FAILED; | 263 | p->RIOError.Error = COPYIN_FAILED; |
270 | return -EFAULT; | 264 | return -EFAULT; |
271 | } | 265 | } |
272 | 266 | ||
273 | if ( KillUnit.Link > 3 ) | 267 | if (KillUnit.Link > 3) |
274 | return -ENXIO; | 268 | return -ENXIO; |
275 | 269 | ||
276 | CmdBlkP = RIOGetCmdBlk(); | 270 | CmdBlkP = RIOGetCmdBlk(); |
277 | 271 | ||
278 | if ( !CmdBlkP ) { | 272 | if (!CmdBlkP) { |
279 | rio_dprintk (RIO_DEBUG_CMD, "UFOAD: GetCmdBlk failed\n"); | 273 | rio_dprintk(RIO_DEBUG_CMD, "UFOAD: GetCmdBlk failed\n"); |
280 | return -ENXIO; | 274 | return -ENXIO; |
281 | } | 275 | } |
282 | 276 | ||
283 | CmdBlkP->Packet.dest_unit = 0; | 277 | CmdBlkP->Packet.dest_unit = 0; |
284 | CmdBlkP->Packet.src_unit = 0; | 278 | CmdBlkP->Packet.src_unit = 0; |
285 | CmdBlkP->Packet.dest_port = BOOT_RUP; | 279 | CmdBlkP->Packet.dest_port = BOOT_RUP; |
286 | CmdBlkP->Packet.src_port = BOOT_RUP; | 280 | CmdBlkP->Packet.src_port = BOOT_RUP; |
287 | CmdBlkP->Packet.len = 0x84; | 281 | CmdBlkP->Packet.len = 0x84; |
288 | CmdBlkP->Packet.data[0] = UFOAD; | 282 | CmdBlkP->Packet.data[0] = UFOAD; |
289 | CmdBlkP->Packet.data[1] = KillUnit.Link; | 283 | CmdBlkP->Packet.data[1] = KillUnit.Link; |
290 | CmdBlkP->Packet.data[2] = UFOAD_MAGIC & 0xFF; | 284 | CmdBlkP->Packet.data[2] = UFOAD_MAGIC & 0xFF; |
291 | CmdBlkP->Packet.data[3] = (UFOAD_MAGIC >> 8) & 0xFF; | 285 | CmdBlkP->Packet.data[3] = (UFOAD_MAGIC >> 8) & 0xFF; |
292 | 286 | ||
293 | for ( Host = 0; Host < p->RIONumHosts; Host++ ) { | 287 | for (Host = 0; Host < p->RIONumHosts; Host++) { |
294 | ID = 0; | 288 | ID = 0; |
295 | HostP = &p->RIOHosts[Host]; | 289 | HostP = &p->RIOHosts[Host]; |
296 | 290 | ||
297 | if ( HostP->UniqueNum == KillUnit.UniqueNum ) { | 291 | if (HostP->UniqueNum == KillUnit.UniqueNum) { |
298 | if ( RIOQueueCmdBlk( HostP, RTAS_PER_HOST+KillUnit.Link, | 292 | if (RIOQueueCmdBlk(HostP, RTAS_PER_HOST + KillUnit.Link, CmdBlkP) == RIO_FAIL) { |
299 | CmdBlkP) == RIO_FAIL ) { | 293 | rio_dprintk(RIO_DEBUG_CMD, "UFOAD: Failed queue command\n"); |
300 | rio_dprintk (RIO_DEBUG_CMD, "UFOAD: Failed queue command\n"); | ||
301 | return -EIO; | 294 | return -EIO; |
302 | } | 295 | } |
303 | return 0; | 296 | return 0; |
304 | } | 297 | } |
305 | 298 | ||
306 | for ( ID=0; ID < RTAS_PER_HOST; ID++ ) { | 299 | for (ID = 0; ID < RTAS_PER_HOST; ID++) { |
307 | if ( HostP->Mapping[ID].RtaUniqueNum == KillUnit.UniqueNum ) { | 300 | if (HostP->Mapping[ID].RtaUniqueNum == KillUnit.UniqueNum) { |
308 | CmdBlkP->Packet.dest_unit = ID+1; | 301 | CmdBlkP->Packet.dest_unit = ID + 1; |
309 | if ( RIOQueueCmdBlk( HostP, ID, CmdBlkP) == RIO_FAIL ) { | 302 | if (RIOQueueCmdBlk(HostP, ID, CmdBlkP) == RIO_FAIL) { |
310 | rio_dprintk (RIO_DEBUG_CMD, "UFOAD: Failed queue command\n"); | 303 | rio_dprintk(RIO_DEBUG_CMD, "UFOAD: Failed queue command\n"); |
311 | return -EIO; | 304 | return -EIO; |
312 | } | 305 | } |
313 | return 0; | 306 | return 0; |
314 | } | 307 | } |
315 | } | 308 | } |
316 | } | 309 | } |
317 | RIOFreeCmdBlk( CmdBlkP ); | 310 | RIOFreeCmdBlk(CmdBlkP); |
318 | return -ENXIO; | 311 | return -ENXIO; |
319 | } | 312 | } |
320 | 313 | ||
321 | int | 314 | int RIOSuspendBootRta(struct Host *HostP, int ID, int Link) |
322 | RIOSuspendBootRta(struct Host *HostP, int ID, int Link) | ||
323 | { | 315 | { |
324 | struct CmdBlk *CmdBlkP; | 316 | struct CmdBlk *CmdBlkP; |
325 | 317 | ||
326 | rio_dprintk (RIO_DEBUG_CMD, "SUSPEND BOOT ON RTA ID %d, link %c\n", ID, 'A' + Link); | 318 | rio_dprintk(RIO_DEBUG_CMD, "SUSPEND BOOT ON RTA ID %d, link %c\n", ID, 'A' + Link); |
327 | 319 | ||
328 | CmdBlkP = RIOGetCmdBlk(); | 320 | CmdBlkP = RIOGetCmdBlk(); |
329 | 321 | ||
330 | if ( !CmdBlkP ) { | 322 | if (!CmdBlkP) { |
331 | rio_dprintk (RIO_DEBUG_CMD, "SUSPEND BOOT ON RTA: GetCmdBlk failed\n"); | 323 | rio_dprintk(RIO_DEBUG_CMD, "SUSPEND BOOT ON RTA: GetCmdBlk failed\n"); |
332 | return -ENXIO; | 324 | return -ENXIO; |
333 | } | 325 | } |
334 | 326 | ||
335 | CmdBlkP->Packet.dest_unit = ID; | 327 | CmdBlkP->Packet.dest_unit = ID; |
336 | CmdBlkP->Packet.dest_port = BOOT_RUP; | 328 | CmdBlkP->Packet.dest_port = BOOT_RUP; |
337 | CmdBlkP->Packet.src_unit = 0; | 329 | CmdBlkP->Packet.src_unit = 0; |
338 | CmdBlkP->Packet.src_port = BOOT_RUP; | 330 | CmdBlkP->Packet.src_port = BOOT_RUP; |
339 | CmdBlkP->Packet.len = 0x84; | 331 | CmdBlkP->Packet.len = 0x84; |
340 | CmdBlkP->Packet.data[0] = IWAIT; | 332 | CmdBlkP->Packet.data[0] = IWAIT; |
341 | CmdBlkP->Packet.data[1] = Link; | 333 | CmdBlkP->Packet.data[1] = Link; |
342 | CmdBlkP->Packet.data[2] = IWAIT_MAGIC & 0xFF; | 334 | CmdBlkP->Packet.data[2] = IWAIT_MAGIC & 0xFF; |
343 | CmdBlkP->Packet.data[3] = (IWAIT_MAGIC >> 8) & 0xFF; | 335 | CmdBlkP->Packet.data[3] = (IWAIT_MAGIC >> 8) & 0xFF; |
344 | 336 | ||
345 | if ( RIOQueueCmdBlk( HostP, ID - 1, CmdBlkP) == RIO_FAIL ) { | 337 | if (RIOQueueCmdBlk(HostP, ID - 1, CmdBlkP) == RIO_FAIL) { |
346 | rio_dprintk (RIO_DEBUG_CMD, "SUSPEND BOOT ON RTA: Failed to queue iwait command\n"); | 338 | rio_dprintk(RIO_DEBUG_CMD, "SUSPEND BOOT ON RTA: Failed to queue iwait command\n"); |
347 | return -EIO; | 339 | return -EIO; |
348 | } | 340 | } |
349 | return 0; | 341 | return 0; |
350 | } | 342 | } |
351 | 343 | ||
352 | int | 344 | int RIOFoadWakeup(struct rio_info *p) |
353 | RIOFoadWakeup(struct rio_info *p) | ||
354 | { | 345 | { |
355 | int port; | 346 | int port; |
356 | register struct Port *PortP; | 347 | register struct Port *PortP; |
357 | unsigned long flags; | 348 | unsigned long flags; |
358 | 349 | ||
359 | for ( port=0; port<RIO_PORTS; port++) { | 350 | for (port = 0; port < RIO_PORTS; port++) { |
360 | PortP = p->RIOPortp[port]; | 351 | PortP = p->RIOPortp[port]; |
361 | 352 | ||
362 | rio_spin_lock_irqsave(&PortP->portSem, flags); | 353 | rio_spin_lock_irqsave(&PortP->portSem, flags); |
@@ -377,16 +368,15 @@ RIOFoadWakeup(struct rio_info *p) | |||
377 | PortP->TxBufferOut = 0; | 368 | PortP->TxBufferOut = 0; |
378 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | 369 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); |
379 | } | 370 | } |
380 | return(0); | 371 | return (0); |
381 | } | 372 | } |
382 | 373 | ||
383 | /* | 374 | /* |
384 | ** Incoming command on the COMMAND_RUP to be processed. | 375 | ** Incoming command on the COMMAND_RUP to be processed. |
385 | */ | 376 | */ |
386 | static int | 377 | static int RIOCommandRup(struct rio_info *p, uint Rup, struct Host *HostP, PKT * PacketP) |
387 | RIOCommandRup(struct rio_info *p, uint Rup, struct Host *HostP, PKT *PacketP) | ||
388 | { | 378 | { |
389 | struct PktCmd *PktCmdP = (struct PktCmd *)PacketP->data; | 379 | struct PktCmd *PktCmdP = (struct PktCmd *) PacketP->data; |
390 | struct Port *PortP; | 380 | struct Port *PortP; |
391 | struct UnixRup *UnixRupP; | 381 | struct UnixRup *UnixRupP; |
392 | ushort SysPort; | 382 | ushort SysPort; |
@@ -395,128 +385,114 @@ RIOCommandRup(struct rio_info *p, uint Rup, struct Host *HostP, PKT *PacketP) | |||
395 | ushort subCommand; | 385 | ushort subCommand; |
396 | unsigned long flags; | 386 | unsigned long flags; |
397 | 387 | ||
398 | func_enter (); | 388 | func_enter(); |
399 | 389 | ||
400 | #ifdef CHECK | 390 | #ifdef CHECK |
401 | CheckHost( Host ); | 391 | CheckHost(Host); |
402 | CheckHostP( HostP ); | 392 | CheckHostP(HostP); |
403 | CheckPacketP( PacketP ); | 393 | CheckPacketP(PacketP); |
404 | #endif | 394 | #endif |
405 | 395 | ||
406 | /* | 396 | /* |
407 | ** 16 port RTA note: | 397 | ** 16 port RTA note: |
408 | ** Command rup packets coming from the RTA will have pkt->data[1] (which | 398 | ** Command rup packets coming from the RTA will have pkt->data[1] (which |
409 | ** translates to PktCmdP->PhbNum) set to the host port number for the | 399 | ** translates to PktCmdP->PhbNum) set to the host port number for the |
410 | ** particular unit. To access the correct BaseSysPort for a 16 port RTA, | 400 | ** particular unit. To access the correct BaseSysPort for a 16 port RTA, |
411 | ** we can use PhbNum to get the rup number for the appropriate 8 port | 401 | ** we can use PhbNum to get the rup number for the appropriate 8 port |
412 | ** block (for the first block, this should be equal to 'Rup'). | 402 | ** block (for the first block, this should be equal to 'Rup'). |
413 | */ | 403 | */ |
414 | rup = RBYTE(PktCmdP->PhbNum) / (ushort)PORTS_PER_RTA; | 404 | rup = RBYTE(PktCmdP->PhbNum) / (ushort) PORTS_PER_RTA; |
415 | UnixRupP = &HostP->UnixRups[rup]; | 405 | UnixRupP = &HostP->UnixRups[rup]; |
416 | SysPort = UnixRupP->BaseSysPort + | 406 | SysPort = UnixRupP->BaseSysPort + (RBYTE(PktCmdP->PhbNum) % (ushort) PORTS_PER_RTA); |
417 | (RBYTE(PktCmdP->PhbNum) % (ushort)PORTS_PER_RTA); | 407 | rio_dprintk(RIO_DEBUG_CMD, "Command on rup %d, port %d\n", rup, SysPort); |
418 | rio_dprintk (RIO_DEBUG_CMD, "Command on rup %d, port %d\n", rup, SysPort); | ||
419 | 408 | ||
420 | #ifdef CHECK | 409 | #ifdef CHECK |
421 | CheckRup( rup ); | 410 | CheckRup(rup); |
422 | CheckUnixRupP( UnixRupP ); | 411 | CheckUnixRupP(UnixRupP); |
423 | #endif | 412 | #endif |
424 | if ( UnixRupP->BaseSysPort == NO_PORT ) { | 413 | if (UnixRupP->BaseSysPort == NO_PORT) { |
425 | rio_dprintk (RIO_DEBUG_CMD, "OBSCURE ERROR!\n"); | 414 | rio_dprintk(RIO_DEBUG_CMD, "OBSCURE ERROR!\n"); |
426 | rio_dprintk (RIO_DEBUG_CMD, "Diagnostics follow. Please WRITE THESE DOWN and report them to Specialix Technical Support\n"); | 415 | rio_dprintk(RIO_DEBUG_CMD, "Diagnostics follow. Please WRITE THESE DOWN and report them to Specialix Technical Support\n"); |
427 | rio_dprintk (RIO_DEBUG_CMD, "CONTROL information: Host number %d, name ``%s''\n", | 416 | rio_dprintk(RIO_DEBUG_CMD, "CONTROL information: Host number %d, name ``%s''\n", HostP - p->RIOHosts, HostP->Name); |
428 | HostP-p->RIOHosts, HostP->Name ); | 417 | rio_dprintk(RIO_DEBUG_CMD, "CONTROL information: Rup number 0x%x\n", rup); |
429 | rio_dprintk (RIO_DEBUG_CMD, "CONTROL information: Rup number 0x%x\n", rup); | 418 | |
430 | 419 | if (Rup >= (ushort) MAX_RUP) { | |
431 | if ( Rup >= (ushort)MAX_RUP ) { | 420 | rio_dprintk(RIO_DEBUG_CMD, "CONTROL information: This is the RUP for RTA ``%s''\n", HostP->Mapping[Rup].Name); |
432 | rio_dprintk (RIO_DEBUG_CMD, "CONTROL information: This is the RUP for RTA ``%s''\n", | ||
433 | HostP->Mapping[Rup].Name); | ||
434 | } else | 421 | } else |
435 | rio_dprintk (RIO_DEBUG_CMD, "CONTROL information: This is the RUP for link ``%c'' of host ``%s''\n", | 422 | rio_dprintk(RIO_DEBUG_CMD, "CONTROL information: This is the RUP for link ``%c'' of host ``%s''\n", ('A' + Rup - MAX_RUP), HostP->Name); |
436 | ('A' + Rup - MAX_RUP), HostP->Name); | 423 | |
437 | 424 | rio_dprintk(RIO_DEBUG_CMD, "PACKET information: Destination 0x%x:0x%x\n", PacketP->dest_unit, PacketP->dest_port); | |
438 | rio_dprintk (RIO_DEBUG_CMD, "PACKET information: Destination 0x%x:0x%x\n", | 425 | rio_dprintk(RIO_DEBUG_CMD, "PACKET information: Source 0x%x:0x%x\n", PacketP->src_unit, PacketP->src_port); |
439 | PacketP->dest_unit, PacketP->dest_port ); | 426 | rio_dprintk(RIO_DEBUG_CMD, "PACKET information: Length 0x%x (%d)\n", PacketP->len, PacketP->len); |
440 | rio_dprintk (RIO_DEBUG_CMD, "PACKET information: Source 0x%x:0x%x\n", | 427 | rio_dprintk(RIO_DEBUG_CMD, "PACKET information: Control 0x%x (%d)\n", PacketP->control, PacketP->control); |
441 | PacketP->src_unit, PacketP->src_port ); | 428 | rio_dprintk(RIO_DEBUG_CMD, "PACKET information: Check 0x%x (%d)\n", PacketP->csum, PacketP->csum); |
442 | rio_dprintk (RIO_DEBUG_CMD, "PACKET information: Length 0x%x (%d)\n", PacketP->len,PacketP->len ); | 429 | rio_dprintk(RIO_DEBUG_CMD, "COMMAND information: Host Port Number 0x%x, " "Command Code 0x%x\n", PktCmdP->PhbNum, PktCmdP->Command); |
443 | rio_dprintk (RIO_DEBUG_CMD, "PACKET information: Control 0x%x (%d)\n", PacketP->control, PacketP->control); | ||
444 | rio_dprintk (RIO_DEBUG_CMD, "PACKET information: Check 0x%x (%d)\n", PacketP->csum, PacketP->csum ); | ||
445 | rio_dprintk (RIO_DEBUG_CMD, "COMMAND information: Host Port Number 0x%x, " | ||
446 | "Command Code 0x%x\n", PktCmdP->PhbNum, PktCmdP->Command ); | ||
447 | return TRUE; | 430 | return TRUE; |
448 | } | 431 | } |
449 | |||
450 | #ifdef CHECK | 432 | #ifdef CHECK |
451 | CheckSysPort( SysPort ); | 433 | CheckSysPort(SysPort); |
452 | #endif | 434 | #endif |
453 | PortP = p->RIOPortp[ SysPort ]; | 435 | PortP = p->RIOPortp[SysPort]; |
454 | rio_spin_lock_irqsave(&PortP->portSem, flags); | 436 | rio_spin_lock_irqsave(&PortP->portSem, flags); |
455 | switch( RBYTE(PktCmdP->Command) ) { | 437 | switch (RBYTE(PktCmdP->Command)) { |
456 | case BREAK_RECEIVED: | 438 | case BREAK_RECEIVED: |
457 | rio_dprintk (RIO_DEBUG_CMD, "Received a break!\n"); | 439 | rio_dprintk(RIO_DEBUG_CMD, "Received a break!\n"); |
458 | /* If the current line disc. is not multi-threading and | 440 | /* If the current line disc. is not multi-threading and |
459 | the current processor is not the default, reset rup_intr | 441 | the current processor is not the default, reset rup_intr |
460 | and return FALSE to ensure that the command packet is | 442 | and return FALSE to ensure that the command packet is |
461 | not freed. */ | 443 | not freed. */ |
462 | /* Call tmgr HANGUP HERE */ | 444 | /* Call tmgr HANGUP HERE */ |
463 | /* Fix this later when every thing works !!!! RAMRAJ */ | 445 | /* Fix this later when every thing works !!!! RAMRAJ */ |
464 | gs_got_break (&PortP->gs); | 446 | gs_got_break(&PortP->gs); |
447 | break; | ||
448 | |||
449 | case COMPLETE: | ||
450 | rio_dprintk(RIO_DEBUG_CMD, "Command complete on phb %d host %d\n", RBYTE(PktCmdP->PhbNum), HostP - p->RIOHosts); | ||
451 | subCommand = 1; | ||
452 | switch (RBYTE(PktCmdP->SubCommand)) { | ||
453 | case MEMDUMP: | ||
454 | rio_dprintk(RIO_DEBUG_CMD, "Memory dump cmd (0x%x) from addr 0x%x\n", RBYTE(PktCmdP->SubCommand), RWORD(PktCmdP->SubAddr)); | ||
465 | break; | 455 | break; |
456 | case READ_REGISTER: | ||
457 | rio_dprintk(RIO_DEBUG_CMD, "Read register (0x%x)\n", RWORD(PktCmdP->SubAddr)); | ||
458 | p->CdRegister = (RBYTE(PktCmdP->ModemStatus) & MSVR1_HOST); | ||
459 | break; | ||
460 | default: | ||
461 | subCommand = 0; | ||
462 | break; | ||
463 | } | ||
464 | if (subCommand) | ||
465 | break; | ||
466 | rio_dprintk(RIO_DEBUG_CMD, "New status is 0x%x was 0x%x\n", RBYTE(PktCmdP->PortStatus), PortP->PortState); | ||
467 | if (PortP->PortState != RBYTE(PktCmdP->PortStatus)) { | ||
468 | rio_dprintk(RIO_DEBUG_CMD, "Mark status & wakeup\n"); | ||
469 | PortP->PortState = RBYTE(PktCmdP->PortStatus); | ||
470 | /* What should we do here ... | ||
471 | wakeup( &PortP->PortState ); | ||
472 | */ | ||
473 | } else | ||
474 | rio_dprintk(RIO_DEBUG_CMD, "No change\n"); | ||
466 | 475 | ||
467 | case COMPLETE: | 476 | /* FALLTHROUGH */ |
468 | rio_dprintk (RIO_DEBUG_CMD, "Command complete on phb %d host %d\n", | 477 | case MODEM_STATUS: |
469 | RBYTE(PktCmdP->PhbNum), HostP-p->RIOHosts); | 478 | /* |
470 | subCommand = 1; | 479 | ** Knock out the tbusy and tstop bits, as these are not relevant |
471 | switch (RBYTE(PktCmdP->SubCommand)) { | 480 | ** to the check for modem status change (they're just there because |
472 | case MEMDUMP : | 481 | ** it's a convenient place to put them!). |
473 | rio_dprintk (RIO_DEBUG_CMD, "Memory dump cmd (0x%x) from addr 0x%x\n", | 482 | */ |
474 | RBYTE(PktCmdP->SubCommand), RWORD(PktCmdP->SubAddr)); | 483 | ReportedModemStatus = RBYTE(PktCmdP->ModemStatus); |
475 | break; | 484 | if ((PortP->ModemState & MSVR1_HOST) == (ReportedModemStatus & MSVR1_HOST)) { |
476 | case READ_REGISTER : | 485 | rio_dprintk(RIO_DEBUG_CMD, "Modem status unchanged 0x%x\n", PortP->ModemState); |
477 | rio_dprintk (RIO_DEBUG_CMD, "Read register (0x%x)\n", RWORD(PktCmdP->SubAddr)); | ||
478 | p->CdRegister = (RBYTE(PktCmdP->ModemStatus) & MSVR1_HOST); | ||
479 | break; | ||
480 | default : | ||
481 | subCommand = 0; | ||
482 | break; | ||
483 | } | ||
484 | if (subCommand) | ||
485 | break; | ||
486 | rio_dprintk (RIO_DEBUG_CMD, "New status is 0x%x was 0x%x\n", | ||
487 | RBYTE(PktCmdP->PortStatus),PortP->PortState); | ||
488 | if (PortP->PortState != RBYTE(PktCmdP->PortStatus)) { | ||
489 | rio_dprintk (RIO_DEBUG_CMD, "Mark status & wakeup\n"); | ||
490 | PortP->PortState = RBYTE(PktCmdP->PortStatus); | ||
491 | /* What should we do here ... | ||
492 | wakeup( &PortP->PortState ); | ||
493 | */ | ||
494 | } else | ||
495 | rio_dprintk (RIO_DEBUG_CMD, "No change\n"); | ||
496 | |||
497 | /* FALLTHROUGH */ | ||
498 | case MODEM_STATUS: | ||
499 | /* | 486 | /* |
500 | ** Knock out the tbusy and tstop bits, as these are not relevant | 487 | ** Update ModemState just in case tbusy or tstop states have |
501 | ** to the check for modem status change (they're just there because | 488 | ** changed. |
502 | ** it's a convenient place to put them!). | 489 | */ |
503 | */ | 490 | PortP->ModemState = ReportedModemStatus; |
504 | ReportedModemStatus = RBYTE(PktCmdP->ModemStatus); | 491 | } else { |
505 | if ((PortP->ModemState & MSVR1_HOST) == | 492 | rio_dprintk(RIO_DEBUG_CMD, "Modem status change from 0x%x to 0x%x\n", PortP->ModemState, ReportedModemStatus); |
506 | (ReportedModemStatus & MSVR1_HOST)) { | 493 | PortP->ModemState = ReportedModemStatus; |
507 | rio_dprintk (RIO_DEBUG_CMD, "Modem status unchanged 0x%x\n", PortP->ModemState); | ||
508 | /* | ||
509 | ** Update ModemState just in case tbusy or tstop states have | ||
510 | ** changed. | ||
511 | */ | ||
512 | PortP->ModemState = ReportedModemStatus; | ||
513 | } | ||
514 | else { | ||
515 | rio_dprintk (RIO_DEBUG_CMD, "Modem status change from 0x%x to 0x%x\n", | ||
516 | PortP->ModemState, ReportedModemStatus); | ||
517 | PortP->ModemState = ReportedModemStatus; | ||
518 | #ifdef MODEM_SUPPORT | 494 | #ifdef MODEM_SUPPORT |
519 | if ( PortP->Mapped ) { | 495 | if (PortP->Mapped) { |
520 | /***********************************************************\ | 496 | /***********************************************************\ |
521 | ************************************************************* | 497 | ************************************************************* |
522 | *** *** | 498 | *** *** |
@@ -525,68 +501,67 @@ RIOCommandRup(struct rio_info *p, uint Rup, struct Host *HostP, PKT *PacketP) | |||
525 | ************************************************************* | 501 | ************************************************************* |
526 | \***********************************************************/ | 502 | \***********************************************************/ |
527 | /* | 503 | /* |
528 | ** If the device is a modem, then check the modem | 504 | ** If the device is a modem, then check the modem |
529 | ** carrier. | 505 | ** carrier. |
530 | */ | 506 | */ |
531 | if (PortP->gs.tty == NULL) | 507 | if (PortP->gs.tty == NULL) |
532 | break; | 508 | break; |
533 | if (PortP->gs.tty->termios == NULL) | 509 | if (PortP->gs.tty->termios == NULL) |
534 | break; | 510 | break; |
535 | |||
536 | if (!(PortP->gs.tty->termios->c_cflag & CLOCAL) && | ||
537 | ((PortP->State & (RIO_MOPEN|RIO_WOPEN)))) { | ||
538 | 511 | ||
539 | rio_dprintk (RIO_DEBUG_CMD, "Is there a Carrier?\n"); | 512 | if (!(PortP->gs.tty->termios->c_cflag & CLOCAL) && ((PortP->State & (RIO_MOPEN | RIO_WOPEN)))) { |
540 | /* | 513 | |
541 | ** Is there a carrier? | 514 | rio_dprintk(RIO_DEBUG_CMD, "Is there a Carrier?\n"); |
542 | */ | 515 | /* |
543 | if ( PortP->ModemState & MSVR1_CD ) { | 516 | ** Is there a carrier? |
544 | /* | 517 | */ |
545 | ** Has carrier just appeared? | 518 | if (PortP->ModemState & MSVR1_CD) { |
546 | */ | 519 | /* |
520 | ** Has carrier just appeared? | ||
521 | */ | ||
547 | if (!(PortP->State & RIO_CARR_ON)) { | 522 | if (!(PortP->State & RIO_CARR_ON)) { |
548 | rio_dprintk (RIO_DEBUG_CMD, "Carrier just came up.\n"); | 523 | rio_dprintk(RIO_DEBUG_CMD, "Carrier just came up.\n"); |
549 | PortP->State |= RIO_CARR_ON; | 524 | PortP->State |= RIO_CARR_ON; |
550 | /* | 525 | /* |
551 | ** wakeup anyone in WOPEN | 526 | ** wakeup anyone in WOPEN |
552 | */ | 527 | */ |
553 | if (PortP->State & (PORT_ISOPEN | RIO_WOPEN) ) | 528 | if (PortP->State & (PORT_ISOPEN | RIO_WOPEN)) |
554 | wake_up_interruptible (&PortP->gs.open_wait); | 529 | wake_up_interruptible(&PortP->gs.open_wait); |
555 | #ifdef STATS | 530 | #ifdef STATS |
556 | PortP->Stat.ModemOnCnt++; | 531 | PortP->Stat.ModemOnCnt++; |
557 | #endif | 532 | #endif |
558 | } | 533 | } |
559 | } else { | 534 | } else { |
560 | /* | 535 | /* |
561 | ** Has carrier just dropped? | 536 | ** Has carrier just dropped? |
562 | */ | 537 | */ |
563 | if (PortP->State & RIO_CARR_ON) { | 538 | if (PortP->State & RIO_CARR_ON) { |
564 | if (PortP->State & (PORT_ISOPEN|RIO_WOPEN|RIO_MOPEN)) | 539 | if (PortP->State & (PORT_ISOPEN | RIO_WOPEN | RIO_MOPEN)) |
565 | tty_hangup (PortP->gs.tty); | 540 | tty_hangup(PortP->gs.tty); |
566 | PortP->State &= ~RIO_CARR_ON; | 541 | PortP->State &= ~RIO_CARR_ON; |
567 | rio_dprintk (RIO_DEBUG_CMD, "Carrirer just went down\n"); | 542 | rio_dprintk(RIO_DEBUG_CMD, "Carrirer just went down\n"); |
568 | #ifdef STATS | 543 | #ifdef STATS |
569 | PortP->Stat.ModemOffCnt++; | 544 | PortP->Stat.ModemOffCnt++; |
570 | #endif | 545 | #endif |
546 | } | ||
547 | } | ||
548 | } | ||
571 | } | 549 | } |
572 | } | ||
573 | } | ||
574 | } | ||
575 | #endif | 550 | #endif |
576 | } | 551 | } |
577 | break; | 552 | break; |
578 | 553 | ||
579 | default: | 554 | default: |
580 | rio_dprintk (RIO_DEBUG_CMD, "Unknown command %d on CMD_RUP of host %d\n", | 555 | rio_dprintk(RIO_DEBUG_CMD, "Unknown command %d on CMD_RUP of host %d\n", RBYTE(PktCmdP->Command), HostP - p->RIOHosts); |
581 | RBYTE(PktCmdP->Command),HostP-p->RIOHosts); | 556 | break; |
582 | break; | ||
583 | } | 557 | } |
584 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | 558 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); |
585 | 559 | ||
586 | func_exit (); | 560 | func_exit(); |
587 | 561 | ||
588 | return TRUE; | 562 | return TRUE; |
589 | } | 563 | } |
564 | |||
590 | /* | 565 | /* |
591 | ** The command mechanism: | 566 | ** The command mechanism: |
592 | ** Each rup has a chain of commands associated with it. | 567 | ** Each rup has a chain of commands associated with it. |
@@ -600,12 +575,11 @@ RIOCommandRup(struct rio_info *p, uint Rup, struct Host *HostP, PKT *PacketP) | |||
600 | /* | 575 | /* |
601 | ** Allocate an empty command block. | 576 | ** Allocate an empty command block. |
602 | */ | 577 | */ |
603 | struct CmdBlk * | 578 | struct CmdBlk *RIOGetCmdBlk(void) |
604 | RIOGetCmdBlk(void) | ||
605 | { | 579 | { |
606 | struct CmdBlk *CmdBlkP; | 580 | struct CmdBlk *CmdBlkP; |
607 | 581 | ||
608 | CmdBlkP = (struct CmdBlk *)sysbrk(sizeof(struct CmdBlk)); | 582 | CmdBlkP = (struct CmdBlk *) sysbrk(sizeof(struct CmdBlk)); |
609 | if (CmdBlkP) | 583 | if (CmdBlkP) |
610 | bzero(CmdBlkP, sizeof(struct CmdBlk)); | 584 | bzero(CmdBlkP, sizeof(struct CmdBlk)); |
611 | 585 | ||
@@ -615,31 +589,29 @@ RIOGetCmdBlk(void) | |||
615 | /* | 589 | /* |
616 | ** Return a block to the head of the free list. | 590 | ** Return a block to the head of the free list. |
617 | */ | 591 | */ |
618 | void | 592 | void RIOFreeCmdBlk(struct CmdBlk *CmdBlkP) |
619 | RIOFreeCmdBlk(struct CmdBlk *CmdBlkP) | ||
620 | { | 593 | { |
621 | sysfree((void *)CmdBlkP, sizeof(struct CmdBlk)); | 594 | sysfree((void *) CmdBlkP, sizeof(struct CmdBlk)); |
622 | } | 595 | } |
623 | 596 | ||
624 | /* | 597 | /* |
625 | ** attach a command block to the list of commands to be performed for | 598 | ** attach a command block to the list of commands to be performed for |
626 | ** a given rup. | 599 | ** a given rup. |
627 | */ | 600 | */ |
628 | int | 601 | int RIOQueueCmdBlk(struct Host *HostP, uint Rup, struct CmdBlk *CmdBlkP) |
629 | RIOQueueCmdBlk(struct Host *HostP, uint Rup, struct CmdBlk *CmdBlkP) | ||
630 | { | 602 | { |
631 | struct CmdBlk **Base; | 603 | struct CmdBlk **Base; |
632 | struct UnixRup *UnixRupP; | 604 | struct UnixRup *UnixRupP; |
633 | unsigned long flags; | 605 | unsigned long flags; |
634 | 606 | ||
635 | #ifdef CHECK | 607 | #ifdef CHECK |
636 | CheckHostP( HostP ); | 608 | CheckHostP(HostP); |
637 | CheckRup( Rup ); | 609 | CheckRup(Rup); |
638 | CheckCmdBlkP( CmdBlkP ); | 610 | CheckCmdBlkP(CmdBlkP); |
639 | #endif | 611 | #endif |
640 | if ( Rup >= (ushort)(MAX_RUP+LINKS_PER_UNIT) ) { | 612 | if (Rup >= (ushort) (MAX_RUP + LINKS_PER_UNIT)) { |
641 | rio_dprintk (RIO_DEBUG_CMD, "Illegal rup number %d in RIOQueueCmdBlk\n",Rup); | 613 | rio_dprintk(RIO_DEBUG_CMD, "Illegal rup number %d in RIOQueueCmdBlk\n", Rup); |
642 | RIOFreeCmdBlk( CmdBlkP ); | 614 | RIOFreeCmdBlk(CmdBlkP); |
643 | return RIO_FAIL; | 615 | return RIO_FAIL; |
644 | } | 616 | } |
645 | 617 | ||
@@ -648,57 +620,52 @@ RIOQueueCmdBlk(struct Host *HostP, uint Rup, struct CmdBlk *CmdBlkP) | |||
648 | rio_spin_lock_irqsave(&UnixRupP->RupLock, flags); | 620 | rio_spin_lock_irqsave(&UnixRupP->RupLock, flags); |
649 | 621 | ||
650 | /* | 622 | /* |
651 | ** If the RUP is currently inactive, then put the request | 623 | ** If the RUP is currently inactive, then put the request |
652 | ** straight on the RUP.... | 624 | ** straight on the RUP.... |
653 | */ | 625 | */ |
654 | if ( (UnixRupP->CmdsWaitingP == NULL) && (UnixRupP->CmdPendingP == NULL) && | 626 | if ((UnixRupP->CmdsWaitingP == NULL) && (UnixRupP->CmdPendingP == NULL) && (RWORD(UnixRupP->RupP->txcontrol) == TX_RUP_INACTIVE) && (CmdBlkP->PreFuncP ? (*CmdBlkP->PreFuncP) (CmdBlkP->PreArg, CmdBlkP) |
655 | (RWORD(UnixRupP->RupP->txcontrol) == TX_RUP_INACTIVE ) && | 627 | : TRUE)) { |
656 | (CmdBlkP->PreFuncP ? (*CmdBlkP->PreFuncP)(CmdBlkP->PreArg,CmdBlkP) | 628 | rio_dprintk(RIO_DEBUG_CMD, "RUP inactive-placing command straight on. Cmd byte is 0x%x\n", CmdBlkP->Packet.data[0]); |
657 | :TRUE)) { | ||
658 | rio_dprintk (RIO_DEBUG_CMD, "RUP inactive-placing command straight on. Cmd byte is 0x%x\n", | ||
659 | CmdBlkP->Packet.data[0]); | ||
660 | 629 | ||
661 | /* | 630 | /* |
662 | ** Whammy! blat that pack! | 631 | ** Whammy! blat that pack! |
663 | */ | 632 | */ |
664 | HostP->Copy( (caddr_t)&CmdBlkP->Packet, | 633 | HostP->Copy((caddr_t) & CmdBlkP->Packet, RIO_PTR(HostP->Caddr, UnixRupP->RupP->txpkt), sizeof(PKT)); |
665 | RIO_PTR(HostP->Caddr, UnixRupP->RupP->txpkt ), sizeof(PKT) ); | ||
666 | 634 | ||
667 | /* | 635 | /* |
668 | ** place command packet on the pending position. | 636 | ** place command packet on the pending position. |
669 | */ | 637 | */ |
670 | UnixRupP->CmdPendingP = CmdBlkP; | 638 | UnixRupP->CmdPendingP = CmdBlkP; |
671 | 639 | ||
672 | /* | 640 | /* |
673 | ** set the command register | 641 | ** set the command register |
674 | */ | 642 | */ |
675 | WWORD(UnixRupP->RupP->txcontrol , TX_PACKET_READY); | 643 | WWORD(UnixRupP->RupP->txcontrol, TX_PACKET_READY); |
676 | 644 | ||
677 | rio_spin_unlock_irqrestore(&UnixRupP->RupLock, flags); | 645 | rio_spin_unlock_irqrestore(&UnixRupP->RupLock, flags); |
678 | 646 | ||
679 | return RIO_SUCCESS; | 647 | return RIO_SUCCESS; |
680 | } | 648 | } |
681 | rio_dprintk (RIO_DEBUG_CMD, "RUP active - en-queing\n"); | 649 | rio_dprintk(RIO_DEBUG_CMD, "RUP active - en-queing\n"); |
682 | 650 | ||
683 | if ( UnixRupP->CmdsWaitingP != NULL) | 651 | if (UnixRupP->CmdsWaitingP != NULL) |
684 | rio_dprintk (RIO_DEBUG_CMD, "Rup active - command waiting\n"); | 652 | rio_dprintk(RIO_DEBUG_CMD, "Rup active - command waiting\n"); |
685 | if ( UnixRupP->CmdPendingP != NULL ) | 653 | if (UnixRupP->CmdPendingP != NULL) |
686 | rio_dprintk (RIO_DEBUG_CMD, "Rup active - command pending\n"); | 654 | rio_dprintk(RIO_DEBUG_CMD, "Rup active - command pending\n"); |
687 | if ( RWORD(UnixRupP->RupP->txcontrol) != TX_RUP_INACTIVE ) | 655 | if (RWORD(UnixRupP->RupP->txcontrol) != TX_RUP_INACTIVE) |
688 | rio_dprintk (RIO_DEBUG_CMD, "Rup active - command rup not ready\n"); | 656 | rio_dprintk(RIO_DEBUG_CMD, "Rup active - command rup not ready\n"); |
689 | 657 | ||
690 | Base = &UnixRupP->CmdsWaitingP; | 658 | Base = &UnixRupP->CmdsWaitingP; |
691 | 659 | ||
692 | rio_dprintk (RIO_DEBUG_CMD, "First try to queue cmdblk 0x%x at 0x%x\n", (int)CmdBlkP,(int)Base); | 660 | rio_dprintk(RIO_DEBUG_CMD, "First try to queue cmdblk 0x%x at 0x%x\n", (int) CmdBlkP, (int) Base); |
693 | 661 | ||
694 | while ( *Base ) { | 662 | while (*Base) { |
695 | rio_dprintk (RIO_DEBUG_CMD, "Command cmdblk 0x%x here\n", (int)(*Base)); | 663 | rio_dprintk(RIO_DEBUG_CMD, "Command cmdblk 0x%x here\n", (int) (*Base)); |
696 | Base = &((*Base)->NextP); | 664 | Base = &((*Base)->NextP); |
697 | rio_dprintk (RIO_DEBUG_CMD, "Now try to queue cmd cmdblk 0x%x at 0x%x\n", | 665 | rio_dprintk(RIO_DEBUG_CMD, "Now try to queue cmd cmdblk 0x%x at 0x%x\n", (int) CmdBlkP, (int) Base); |
698 | (int)CmdBlkP,(int)Base); | ||
699 | } | 666 | } |
700 | 667 | ||
701 | rio_dprintk (RIO_DEBUG_CMD, "Will queue cmdblk 0x%x at 0x%x\n",(int)CmdBlkP,(int)Base); | 668 | rio_dprintk(RIO_DEBUG_CMD, "Will queue cmdblk 0x%x at 0x%x\n", (int) CmdBlkP, (int) Base); |
702 | 669 | ||
703 | *Base = CmdBlkP; | 670 | *Base = CmdBlkP; |
704 | 671 | ||
@@ -713,8 +680,7 @@ RIOQueueCmdBlk(struct Host *HostP, uint Rup, struct CmdBlk *CmdBlkP) | |||
713 | ** Here we go - if there is an empty rup, fill it! | 680 | ** Here we go - if there is an empty rup, fill it! |
714 | ** must be called at splrio() or higher. | 681 | ** must be called at splrio() or higher. |
715 | */ | 682 | */ |
716 | void | 683 | void RIOPollHostCommands(struct rio_info *p, struct Host *HostP) |
717 | RIOPollHostCommands(struct rio_info *p, struct Host *HostP) | ||
718 | { | 684 | { |
719 | register struct CmdBlk *CmdBlkP; | 685 | register struct CmdBlk *CmdBlkP; |
720 | register struct UnixRup *UnixRupP; | 686 | register struct UnixRup *UnixRupP; |
@@ -723,262 +689,246 @@ RIOPollHostCommands(struct rio_info *p, struct Host *HostP) | |||
723 | unsigned long flags; | 689 | unsigned long flags; |
724 | 690 | ||
725 | 691 | ||
726 | Rup = MAX_RUP+LINKS_PER_UNIT; | 692 | Rup = MAX_RUP + LINKS_PER_UNIT; |
727 | 693 | ||
728 | do { /* do this loop for each RUP */ | 694 | do { /* do this loop for each RUP */ |
729 | /* | 695 | /* |
730 | ** locate the rup we are processing & lock it | 696 | ** locate the rup we are processing & lock it |
731 | */ | 697 | */ |
732 | UnixRupP = &HostP->UnixRups[--Rup]; | 698 | UnixRupP = &HostP->UnixRups[--Rup]; |
733 | 699 | ||
734 | spin_lock_irqsave(&UnixRupP->RupLock, flags); | 700 | spin_lock_irqsave(&UnixRupP->RupLock, flags); |
735 | 701 | ||
736 | /* | 702 | /* |
737 | ** First check for incoming commands: | 703 | ** First check for incoming commands: |
738 | */ | 704 | */ |
739 | if ( RWORD(UnixRupP->RupP->rxcontrol) != RX_RUP_INACTIVE ) { | 705 | if (RWORD(UnixRupP->RupP->rxcontrol) != RX_RUP_INACTIVE) { |
740 | int FreeMe; | 706 | int FreeMe; |
741 | 707 | ||
742 | PacketP =(PKT *)RIO_PTR(HostP->Caddr,RWORD(UnixRupP->RupP->rxpkt)); | 708 | PacketP = (PKT *) RIO_PTR(HostP->Caddr, RWORD(UnixRupP->RupP->rxpkt)); |
743 | 709 | ||
744 | ShowPacket( DBG_CMD, PacketP ); | 710 | ShowPacket(DBG_CMD, PacketP); |
745 | 711 | ||
746 | switch ( RBYTE(PacketP->dest_port) ) { | 712 | switch (RBYTE(PacketP->dest_port)) { |
747 | case BOOT_RUP: | 713 | case BOOT_RUP: |
748 | rio_dprintk (RIO_DEBUG_CMD, "Incoming Boot %s packet '%x'\n", | 714 | rio_dprintk(RIO_DEBUG_CMD, "Incoming Boot %s packet '%x'\n", RBYTE(PacketP->len) & 0x80 ? "Command" : "Data", RBYTE(PacketP->data[0])); |
749 | RBYTE(PacketP->len) & 0x80 ? "Command":"Data", | 715 | rio_spin_unlock_irqrestore(&UnixRupP->RupLock, flags); |
750 | RBYTE(PacketP->data[0])); | 716 | FreeMe = RIOBootRup(p, Rup, HostP, PacketP); |
751 | rio_spin_unlock_irqrestore(&UnixRupP->RupLock, flags); | 717 | rio_spin_lock_irqsave(&UnixRupP->RupLock, flags); |
752 | FreeMe= RIOBootRup(p, Rup,HostP,PacketP); | 718 | break; |
753 | rio_spin_lock_irqsave(&UnixRupP->RupLock, flags); | ||
754 | break; | ||
755 | 719 | ||
756 | case COMMAND_RUP: | 720 | case COMMAND_RUP: |
757 | /* | 721 | /* |
758 | ** Free the RUP lock as loss of carrier causes a | 722 | ** Free the RUP lock as loss of carrier causes a |
759 | ** ttyflush which will (eventually) call another | 723 | ** ttyflush which will (eventually) call another |
760 | ** routine that uses the RUP lock. | 724 | ** routine that uses the RUP lock. |
761 | */ | 725 | */ |
762 | rio_spin_unlock_irqrestore(&UnixRupP->RupLock, flags); | 726 | rio_spin_unlock_irqrestore(&UnixRupP->RupLock, flags); |
763 | FreeMe= RIOCommandRup(p, Rup,HostP,PacketP); | 727 | FreeMe = RIOCommandRup(p, Rup, HostP, PacketP); |
764 | if (PacketP->data[5] == MEMDUMP) { | 728 | if (PacketP->data[5] == MEMDUMP) { |
765 | rio_dprintk (RIO_DEBUG_CMD, "Memdump from 0x%x complete\n", | 729 | rio_dprintk(RIO_DEBUG_CMD, "Memdump from 0x%x complete\n", *(ushort *) & (PacketP->data[6])); |
766 | *(ushort *) &(PacketP->data[6])); | 730 | HostP->Copy((caddr_t) & (PacketP->data[8]), (caddr_t) p->RIOMemDump, 32); |
767 | HostP->Copy( (caddr_t)&(PacketP->data[8]), | 731 | } |
768 | (caddr_t)p->RIOMemDump, 32 ); | 732 | rio_spin_lock_irqsave(&UnixRupP->RupLock, flags); |
769 | } | 733 | break; |
770 | rio_spin_lock_irqsave(&UnixRupP->RupLock, flags); | ||
771 | break; | ||
772 | 734 | ||
773 | case ROUTE_RUP: | 735 | case ROUTE_RUP: |
774 | rio_spin_unlock_irqrestore( &UnixRupP->RupLock, flags); | 736 | rio_spin_unlock_irqrestore(&UnixRupP->RupLock, flags); |
775 | FreeMe = RIORouteRup(p, Rup, HostP, PacketP ); | 737 | FreeMe = RIORouteRup(p, Rup, HostP, PacketP); |
776 | rio_spin_lock_irqsave( &UnixRupP->RupLock, flags ); | 738 | rio_spin_lock_irqsave(&UnixRupP->RupLock, flags); |
777 | break; | 739 | break; |
778 | 740 | ||
779 | default: | 741 | default: |
780 | rio_dprintk (RIO_DEBUG_CMD, "Unknown RUP %d\n", RBYTE(PacketP->dest_port)); | 742 | rio_dprintk(RIO_DEBUG_CMD, "Unknown RUP %d\n", RBYTE(PacketP->dest_port)); |
781 | FreeMe = 1; | 743 | FreeMe = 1; |
782 | break; | 744 | break; |
783 | } | 745 | } |
784 | 746 | ||
785 | if ( FreeMe ) { | 747 | if (FreeMe) { |
786 | rio_dprintk (RIO_DEBUG_CMD, "Free processed incoming command packet\n"); | 748 | rio_dprintk(RIO_DEBUG_CMD, "Free processed incoming command packet\n"); |
787 | put_free_end(HostP,PacketP); | 749 | put_free_end(HostP, PacketP); |
788 | 750 | ||
789 | WWORD(UnixRupP->RupP->rxcontrol , RX_RUP_INACTIVE); | 751 | WWORD(UnixRupP->RupP->rxcontrol, RX_RUP_INACTIVE); |
790 | 752 | ||
791 | if ( RWORD(UnixRupP->RupP->handshake)==PHB_HANDSHAKE_SET ) { | 753 | if (RWORD(UnixRupP->RupP->handshake) == PHB_HANDSHAKE_SET) { |
792 | rio_dprintk (RIO_DEBUG_CMD, "Handshake rup %d\n",Rup); | 754 | rio_dprintk(RIO_DEBUG_CMD, "Handshake rup %d\n", Rup); |
793 | WWORD(UnixRupP->RupP->handshake, | 755 | WWORD(UnixRupP->RupP->handshake, PHB_HANDSHAKE_SET | PHB_HANDSHAKE_RESET); |
794 | PHB_HANDSHAKE_SET|PHB_HANDSHAKE_RESET); | ||
795 | } | 756 | } |
796 | } | 757 | } |
797 | } | 758 | } |
798 | 759 | ||
799 | /* | 760 | /* |
800 | ** IF a command was running on the port, | 761 | ** IF a command was running on the port, |
801 | ** and it has completed, then tidy it up. | 762 | ** and it has completed, then tidy it up. |
802 | */ | 763 | */ |
803 | if ( (CmdBlkP = UnixRupP->CmdPendingP) && /* ASSIGN! */ | 764 | if ((CmdBlkP = UnixRupP->CmdPendingP) && /* ASSIGN! */ |
804 | (RWORD(UnixRupP->RupP->txcontrol) == TX_RUP_INACTIVE)) { | 765 | (RWORD(UnixRupP->RupP->txcontrol) == TX_RUP_INACTIVE)) { |
805 | /* | 766 | /* |
806 | ** we are idle. | 767 | ** we are idle. |
807 | ** there is a command in pending. | 768 | ** there is a command in pending. |
808 | ** Therefore, this command has finished. | 769 | ** Therefore, this command has finished. |
809 | ** So, wakeup whoever is waiting for it (and tell them | 770 | ** So, wakeup whoever is waiting for it (and tell them |
810 | ** what happened). | 771 | ** what happened). |
811 | */ | 772 | */ |
812 | if ( CmdBlkP->Packet.dest_port == BOOT_RUP ) | 773 | if (CmdBlkP->Packet.dest_port == BOOT_RUP) |
813 | rio_dprintk (RIO_DEBUG_CMD, "Free Boot %s Command Block '%x'\n", | 774 | rio_dprintk(RIO_DEBUG_CMD, "Free Boot %s Command Block '%x'\n", CmdBlkP->Packet.len & 0x80 ? "Command" : "Data", CmdBlkP->Packet.data[0]); |
814 | CmdBlkP->Packet.len & 0x80 ? "Command":"Data", | 775 | |
815 | CmdBlkP->Packet.data[0]); | 776 | rio_dprintk(RIO_DEBUG_CMD, "Command 0x%x completed\n", (int) CmdBlkP); |
816 | |||
817 | rio_dprintk (RIO_DEBUG_CMD, "Command 0x%x completed\n",(int)CmdBlkP); | ||
818 | 777 | ||
819 | /* | 778 | /* |
820 | ** Clear the Rup lock to prevent mutual exclusion. | 779 | ** Clear the Rup lock to prevent mutual exclusion. |
821 | */ | 780 | */ |
822 | if ( CmdBlkP->PostFuncP ) { | 781 | if (CmdBlkP->PostFuncP) { |
823 | rio_spin_unlock_irqrestore(&UnixRupP->RupLock, flags); | 782 | rio_spin_unlock_irqrestore(&UnixRupP->RupLock, flags); |
824 | (*CmdBlkP->PostFuncP) (CmdBlkP->PostArg,CmdBlkP); | 783 | (*CmdBlkP->PostFuncP) (CmdBlkP->PostArg, CmdBlkP); |
825 | rio_spin_lock_irqsave(&UnixRupP->RupLock, flags); | 784 | rio_spin_lock_irqsave(&UnixRupP->RupLock, flags); |
826 | } | 785 | } |
827 | 786 | ||
828 | /* | 787 | /* |
829 | ** ....clear the pending flag.... | 788 | ** ....clear the pending flag.... |
830 | */ | 789 | */ |
831 | UnixRupP->CmdPendingP = NULL; | 790 | UnixRupP->CmdPendingP = NULL; |
832 | 791 | ||
833 | /* | 792 | /* |
834 | ** ....and return the command block to the freelist. | 793 | ** ....and return the command block to the freelist. |
835 | */ | 794 | */ |
836 | RIOFreeCmdBlk( CmdBlkP ); | 795 | RIOFreeCmdBlk(CmdBlkP); |
837 | } | 796 | } |
838 | 797 | ||
839 | /* | 798 | /* |
840 | ** If there is a command for this rup, and the rup | 799 | ** If there is a command for this rup, and the rup |
841 | ** is idle, then process the command | 800 | ** is idle, then process the command |
842 | */ | 801 | */ |
843 | if ( (CmdBlkP = UnixRupP->CmdsWaitingP) && /* ASSIGN! */ | 802 | if ((CmdBlkP = UnixRupP->CmdsWaitingP) && /* ASSIGN! */ |
844 | (UnixRupP->CmdPendingP == NULL) && | 803 | (UnixRupP->CmdPendingP == NULL) && (RWORD(UnixRupP->RupP->txcontrol) == TX_RUP_INACTIVE)) { |
845 | (RWORD(UnixRupP->RupP->txcontrol) == TX_RUP_INACTIVE)) { | ||
846 | /* | 804 | /* |
847 | ** if the pre-function is non-zero, call it. | 805 | ** if the pre-function is non-zero, call it. |
848 | ** If it returns RIO_FAIL then don't | 806 | ** If it returns RIO_FAIL then don't |
849 | ** send this command yet! | 807 | ** send this command yet! |
850 | */ | 808 | */ |
851 | #ifdef CHECK | 809 | #ifdef CHECK |
852 | CheckCmdBlkP (CmdBlkP); | 810 | CheckCmdBlkP(CmdBlkP); |
853 | #endif | 811 | #endif |
854 | if ( !(CmdBlkP->PreFuncP ? | 812 | if (!(CmdBlkP->PreFuncP ? (*CmdBlkP->PreFuncP) (CmdBlkP->PreArg, CmdBlkP) : TRUE)) { |
855 | (*CmdBlkP->PreFuncP)(CmdBlkP->PreArg, CmdBlkP) : TRUE)) { | 813 | rio_dprintk(RIO_DEBUG_CMD, "Not ready to start command 0x%x\n", (int) CmdBlkP); |
856 | rio_dprintk (RIO_DEBUG_CMD, "Not ready to start command 0x%x\n",(int)CmdBlkP); | 814 | } else { |
857 | } | 815 | rio_dprintk(RIO_DEBUG_CMD, "Start new command 0x%x Cmd byte is 0x%x\n", (int) CmdBlkP, CmdBlkP->Packet.data[0]); |
858 | else { | ||
859 | rio_dprintk (RIO_DEBUG_CMD, "Start new command 0x%x Cmd byte is 0x%x\n", | ||
860 | (int)CmdBlkP, CmdBlkP->Packet.data[0]); | ||
861 | /* | 816 | /* |
862 | ** Whammy! blat that pack! | 817 | ** Whammy! blat that pack! |
863 | */ | 818 | */ |
864 | #ifdef CHECK | 819 | #ifdef CHECK |
865 | CheckPacketP ((PKT *)RIO_PTR(HostP->Caddr, UnixRupP->RupP->txpkt)); | 820 | CheckPacketP((PKT *) RIO_PTR(HostP->Caddr, UnixRupP->RupP->txpkt)); |
866 | #endif | 821 | #endif |
867 | HostP->Copy( (caddr_t)&CmdBlkP->Packet, | 822 | HostP->Copy((caddr_t) & CmdBlkP->Packet, RIO_PTR(HostP->Caddr, UnixRupP->RupP->txpkt), sizeof(PKT)); |
868 | RIO_PTR(HostP->Caddr, UnixRupP->RupP->txpkt), sizeof(PKT)); | ||
869 | 823 | ||
870 | /* | 824 | /* |
871 | ** remove the command from the rup command queue... | 825 | ** remove the command from the rup command queue... |
872 | */ | 826 | */ |
873 | UnixRupP->CmdsWaitingP = CmdBlkP->NextP; | 827 | UnixRupP->CmdsWaitingP = CmdBlkP->NextP; |
874 | 828 | ||
875 | /* | 829 | /* |
876 | ** ...and place it on the pending position. | 830 | ** ...and place it on the pending position. |
877 | */ | 831 | */ |
878 | UnixRupP->CmdPendingP = CmdBlkP; | 832 | UnixRupP->CmdPendingP = CmdBlkP; |
879 | 833 | ||
880 | /* | 834 | /* |
881 | ** set the command register | 835 | ** set the command register |
882 | */ | 836 | */ |
883 | WWORD(UnixRupP->RupP->txcontrol,TX_PACKET_READY); | 837 | WWORD(UnixRupP->RupP->txcontrol, TX_PACKET_READY); |
884 | 838 | ||
885 | /* | 839 | /* |
886 | ** the command block will be freed | 840 | ** the command block will be freed |
887 | ** when the command has been processed. | 841 | ** when the command has been processed. |
888 | */ | 842 | */ |
889 | } | 843 | } |
890 | } | 844 | } |
891 | spin_unlock_irqrestore(&UnixRupP->RupLock, flags); | 845 | spin_unlock_irqrestore(&UnixRupP->RupLock, flags); |
892 | } while ( Rup ); | 846 | } while (Rup); |
893 | } | 847 | } |
894 | 848 | ||
895 | int | 849 | int RIOWFlushMark(int iPortP, struct CmdBlk *CmdBlkP) |
896 | RIOWFlushMark(int iPortP, struct CmdBlk *CmdBlkP) | ||
897 | { | 850 | { |
898 | struct Port * PortP = (struct Port *)iPortP; | 851 | struct Port *PortP = (struct Port *) iPortP; |
899 | unsigned long flags; | 852 | unsigned long flags; |
900 | 853 | ||
901 | rio_spin_lock_irqsave(&PortP->portSem, flags); | 854 | rio_spin_lock_irqsave(&PortP->portSem, flags); |
902 | #ifdef CHECK | 855 | #ifdef CHECK |
903 | CheckPortP( PortP ); | 856 | CheckPortP(PortP); |
904 | #endif | 857 | #endif |
905 | PortP->WflushFlag++; | 858 | PortP->WflushFlag++; |
906 | PortP->MagicFlags |= MAGIC_FLUSH; | 859 | PortP->MagicFlags |= MAGIC_FLUSH; |
907 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | 860 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); |
908 | return RIOUnUse( iPortP, CmdBlkP ); | 861 | return RIOUnUse(iPortP, CmdBlkP); |
909 | } | 862 | } |
910 | 863 | ||
911 | int | 864 | int RIORFlushEnable(int iPortP, struct CmdBlk *CmdBlkP) |
912 | RIORFlushEnable(int iPortP, struct CmdBlk *CmdBlkP) | ||
913 | { | 865 | { |
914 | struct Port * PortP = (struct Port *)iPortP; | 866 | struct Port *PortP = (struct Port *) iPortP; |
915 | PKT *PacketP; | 867 | PKT *PacketP; |
916 | unsigned long flags; | 868 | unsigned long flags; |
917 | 869 | ||
918 | rio_spin_lock_irqsave(&PortP->portSem, flags); | 870 | rio_spin_lock_irqsave(&PortP->portSem, flags); |
919 | 871 | ||
920 | while ( can_remove_receive(&PacketP, PortP) ) { | 872 | while (can_remove_receive(&PacketP, PortP)) { |
921 | remove_receive(PortP); | 873 | remove_receive(PortP); |
922 | ShowPacket(DBG_PROC, PacketP ); | 874 | ShowPacket(DBG_PROC, PacketP); |
923 | put_free_end( PortP->HostP, PacketP ); | 875 | put_free_end(PortP->HostP, PacketP); |
924 | } | 876 | } |
925 | 877 | ||
926 | if ( RWORD(PortP->PhbP->handshake)==PHB_HANDSHAKE_SET ) { | 878 | if (RWORD(PortP->PhbP->handshake) == PHB_HANDSHAKE_SET) { |
927 | /* | 879 | /* |
928 | ** MAGIC! (Basically, handshake the RX buffer, so that | 880 | ** MAGIC! (Basically, handshake the RX buffer, so that |
929 | ** the RTAs upstream can be re-enabled.) | 881 | ** the RTAs upstream can be re-enabled.) |
930 | */ | 882 | */ |
931 | rio_dprintk (RIO_DEBUG_CMD, "Util: Set RX handshake bit\n"); | 883 | rio_dprintk(RIO_DEBUG_CMD, "Util: Set RX handshake bit\n"); |
932 | WWORD(PortP->PhbP->handshake, PHB_HANDSHAKE_SET|PHB_HANDSHAKE_RESET); | 884 | WWORD(PortP->PhbP->handshake, PHB_HANDSHAKE_SET | PHB_HANDSHAKE_RESET); |
933 | } | 885 | } |
934 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | 886 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); |
935 | return RIOUnUse( iPortP, CmdBlkP ); | 887 | return RIOUnUse(iPortP, CmdBlkP); |
936 | } | 888 | } |
937 | 889 | ||
938 | int | 890 | int RIOUnUse(int iPortP, struct CmdBlk *CmdBlkP) |
939 | RIOUnUse(int iPortP, struct CmdBlk *CmdBlkP) | ||
940 | { | 891 | { |
941 | struct Port * PortP = (struct Port *)iPortP; | 892 | struct Port *PortP = (struct Port *) iPortP; |
942 | unsigned long flags; | 893 | unsigned long flags; |
943 | 894 | ||
944 | rio_spin_lock_irqsave(&PortP->portSem, flags); | 895 | rio_spin_lock_irqsave(&PortP->portSem, flags); |
945 | 896 | ||
946 | #ifdef CHECK | 897 | #ifdef CHECK |
947 | CheckPortP( PortP ); | 898 | CheckPortP(PortP); |
948 | #endif | 899 | #endif |
949 | rio_dprintk (RIO_DEBUG_CMD, "Decrement in use count for port\n"); | 900 | rio_dprintk(RIO_DEBUG_CMD, "Decrement in use count for port\n"); |
950 | 901 | ||
951 | if (PortP->InUse) { | 902 | if (PortP->InUse) { |
952 | if ( --PortP->InUse != NOT_INUSE ) { | 903 | if (--PortP->InUse != NOT_INUSE) { |
953 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | 904 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); |
954 | return 0; | 905 | return 0; |
955 | } | 906 | } |
956 | } | 907 | } |
957 | /* | 908 | /* |
958 | ** While PortP->InUse is set (i.e. a preemptive command has been sent to | 909 | ** While PortP->InUse is set (i.e. a preemptive command has been sent to |
959 | ** the RTA and is awaiting completion), any transmit data is prevented from | 910 | ** the RTA and is awaiting completion), any transmit data is prevented from |
960 | ** being transferred from the write queue into the transmit packets | 911 | ** being transferred from the write queue into the transmit packets |
961 | ** (add_transmit) and no furthur transmit interrupt will be sent for that | 912 | ** (add_transmit) and no furthur transmit interrupt will be sent for that |
962 | ** data. The next interrupt will occur up to 500ms later (RIOIntr is called | 913 | ** data. The next interrupt will occur up to 500ms later (RIOIntr is called |
963 | ** twice a second as a saftey measure). This was the case when kermit was | 914 | ** twice a second as a saftey measure). This was the case when kermit was |
964 | ** used to send data into a RIO port. After each packet was sent, TCFLSH | 915 | ** used to send data into a RIO port. After each packet was sent, TCFLSH |
965 | ** was called to flush the read queue preemptively. PortP->InUse was | 916 | ** was called to flush the read queue preemptively. PortP->InUse was |
966 | ** incremented, thereby blocking the 6 byte acknowledgement packet | 917 | ** incremented, thereby blocking the 6 byte acknowledgement packet |
967 | ** transmitted back. This acknowledgment hung around for 500ms before | 918 | ** transmitted back. This acknowledgment hung around for 500ms before |
968 | ** being sent, thus reducing input performance substantially!. | 919 | ** being sent, thus reducing input performance substantially!. |
969 | ** When PortP->InUse becomes NOT_INUSE, we must ensure that any data | 920 | ** When PortP->InUse becomes NOT_INUSE, we must ensure that any data |
970 | ** hanging around in the transmit buffer is sent immediately. | 921 | ** hanging around in the transmit buffer is sent immediately. |
971 | */ | 922 | */ |
972 | WWORD(PortP->HostP->ParmMapP->tx_intr, 1); | 923 | WWORD(PortP->HostP->ParmMapP->tx_intr, 1); |
973 | /* What to do here .. | 924 | /* What to do here .. |
974 | wakeup( (caddr_t)&(PortP->InUse) ); | 925 | wakeup( (caddr_t)&(PortP->InUse) ); |
975 | */ | 926 | */ |
976 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | 927 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); |
977 | return 0; | 928 | return 0; |
978 | } | 929 | } |
979 | 930 | ||
980 | void | 931 | void ShowPacket(uint Flags, struct PKT *PacketP) |
981 | ShowPacket(uint Flags, struct PKT *PacketP) | ||
982 | { | 932 | { |
983 | } | 933 | } |
984 | 934 | ||
diff --git a/drivers/char/rio/rioctrl.c b/drivers/char/rio/rioctrl.c index b4d1a23e27e4..0b7700d2f049 100644 --- a/drivers/char/rio/rioctrl.c +++ b/drivers/char/rio/rioctrl.c | |||
@@ -82,16 +82,16 @@ static char *_rioctrl_c_sccs_ = "@(#)rioctrl.c 1.3"; | |||
82 | #include "rioioctl.h" | 82 | #include "rioioctl.h" |
83 | 83 | ||
84 | 84 | ||
85 | static struct LpbReq LpbReq; | 85 | static struct LpbReq LpbReq; |
86 | static struct RupReq RupReq; | 86 | static struct RupReq RupReq; |
87 | static struct PortReq PortReq; | 87 | static struct PortReq PortReq; |
88 | static struct HostReq HostReq; | 88 | static struct HostReq HostReq; |
89 | static struct HostDpRam HostDpRam; | 89 | static struct HostDpRam HostDpRam; |
90 | static struct DebugCtrl DebugCtrl; | 90 | static struct DebugCtrl DebugCtrl; |
91 | static struct Map MapEnt; | 91 | static struct Map MapEnt; |
92 | static struct PortSetup PortSetup; | 92 | static struct PortSetup PortSetup; |
93 | static struct DownLoad DownLoad; | 93 | static struct DownLoad DownLoad; |
94 | static struct SendPack SendPack; | 94 | static struct SendPack SendPack; |
95 | /* static struct StreamInfo StreamInfo; */ | 95 | /* static struct StreamInfo StreamInfo; */ |
96 | /* static char modemtable[RIO_PORTS]; */ | 96 | /* static char modemtable[RIO_PORTS]; */ |
97 | static struct SpecialRupCmd SpecialRupCmd; | 97 | static struct SpecialRupCmd SpecialRupCmd; |
@@ -99,18 +99,18 @@ static struct PortParams PortParams; | |||
99 | static struct portStats portStats; | 99 | static struct portStats portStats; |
100 | 100 | ||
101 | static struct SubCmdStruct { | 101 | static struct SubCmdStruct { |
102 | ushort Host; | 102 | ushort Host; |
103 | ushort Rup; | 103 | ushort Rup; |
104 | ushort Port; | 104 | ushort Port; |
105 | ushort Addr; | 105 | ushort Addr; |
106 | } SubCmd; | 106 | } SubCmd; |
107 | 107 | ||
108 | struct PortTty { | 108 | struct PortTty { |
109 | uint port; | 109 | uint port; |
110 | struct ttystatics Tty; | 110 | struct ttystatics Tty; |
111 | }; | 111 | }; |
112 | 112 | ||
113 | static struct PortTty PortTty; | 113 | static struct PortTty PortTty; |
114 | typedef struct ttystatics TERMIO; | 114 | typedef struct ttystatics TERMIO; |
115 | 115 | ||
116 | /* | 116 | /* |
@@ -121,267 +121,264 @@ typedef struct ttystatics TERMIO; | |||
121 | ** The RIOBootCodeUNKNOWN entry is there to politely tell the calling | 121 | ** The RIOBootCodeUNKNOWN entry is there to politely tell the calling |
122 | ** process to bog off. | 122 | ** process to bog off. |
123 | */ | 123 | */ |
124 | static int | 124 | static int |
125 | (*RIOBootTable[MAX_PRODUCT])(struct rio_info *, struct DownLoad *) = | 125 | (*RIOBootTable[MAX_PRODUCT]) (struct rio_info *, struct DownLoad *) = { |
126 | { | 126 | /* 0 */ RIOBootCodeHOST, |
127 | /* 0 */ RIOBootCodeHOST, /* Host Card */ | 127 | /* Host Card */ |
128 | /* 1 */ RIOBootCodeRTA, /* RTA */ | 128 | /* 1 */ RIOBootCodeRTA, |
129 | /* RTA */ | ||
129 | }; | 130 | }; |
130 | 131 | ||
131 | #define drv_makedev(maj, min) ((((uint) maj & 0xff) << 8) | ((uint) min & 0xff)) | 132 | #define drv_makedev(maj, min) ((((uint) maj & 0xff) << 8) | ((uint) min & 0xff)) |
132 | 133 | ||
133 | int copyin (int arg, caddr_t dp, int siz) | 134 | int copyin(int arg, caddr_t dp, int siz) |
134 | { | 135 | { |
135 | int rv; | 136 | int rv; |
136 | 137 | ||
137 | rio_dprintk (RIO_DEBUG_CTRL, "Copying %d bytes from user %p to %p.\n", siz, (void *)arg, dp); | 138 | rio_dprintk(RIO_DEBUG_CTRL, "Copying %d bytes from user %p to %p.\n", siz, (void *) arg, dp); |
138 | rv = copy_from_user (dp, (void *)arg, siz); | 139 | rv = copy_from_user(dp, (void *) arg, siz); |
139 | if (rv) return COPYFAIL; | 140 | if (rv) |
140 | else return rv; | 141 | return COPYFAIL; |
142 | else | ||
143 | return rv; | ||
141 | } | 144 | } |
142 | 145 | ||
143 | static int copyout (caddr_t dp, int arg, int siz) | 146 | static int copyout(caddr_t dp, int arg, int siz) |
144 | { | 147 | { |
145 | int rv; | 148 | int rv; |
146 | 149 | ||
147 | rio_dprintk (RIO_DEBUG_CTRL, "Copying %d bytes to user %p from %p.\n", siz, (void *)arg, dp); | 150 | rio_dprintk(RIO_DEBUG_CTRL, "Copying %d bytes to user %p from %p.\n", siz, (void *) arg, dp); |
148 | rv = copy_to_user ((void *)arg, dp, siz); | 151 | rv = copy_to_user((void *) arg, dp, siz); |
149 | if (rv) return COPYFAIL; | 152 | if (rv) |
150 | else return rv; | 153 | return COPYFAIL; |
154 | else | ||
155 | return rv; | ||
151 | } | 156 | } |
152 | 157 | ||
153 | int | 158 | int riocontrol(p, dev, cmd, arg, su) |
154 | riocontrol(p, dev, cmd, arg, su) | 159 | struct rio_info *p; |
155 | struct rio_info * p; | 160 | dev_t dev; |
156 | dev_t dev; | 161 | int cmd; |
157 | int cmd; | 162 | caddr_t arg; |
158 | caddr_t arg; | 163 | int su; |
159 | int su; | ||
160 | { | 164 | { |
161 | uint Host; /* leave me unsigned! */ | 165 | uint Host; /* leave me unsigned! */ |
162 | uint port; /* and me! */ | 166 | uint port; /* and me! */ |
163 | struct Host *HostP; | 167 | struct Host *HostP; |
164 | ushort loop; | 168 | ushort loop; |
165 | int Entry; | 169 | int Entry; |
166 | struct Port *PortP; | 170 | struct Port *PortP; |
167 | PKT *PacketP; | 171 | PKT *PacketP; |
168 | int retval = 0; | 172 | int retval = 0; |
169 | unsigned long flags; | 173 | unsigned long flags; |
170 | 174 | ||
171 | func_enter (); | 175 | func_enter(); |
172 | 176 | ||
173 | /* Confuse the compiler to think that we've initialized these */ | 177 | /* Confuse the compiler to think that we've initialized these */ |
174 | Host=0; | 178 | Host = 0; |
175 | PortP = NULL; | 179 | PortP = NULL; |
176 | 180 | ||
177 | rio_dprintk (RIO_DEBUG_CTRL, "control ioctl cmd: 0x%x arg: 0x%x\n", cmd, (int)arg); | 181 | rio_dprintk(RIO_DEBUG_CTRL, "control ioctl cmd: 0x%x arg: 0x%x\n", cmd, (int) arg); |
178 | 182 | ||
179 | switch (cmd) { | 183 | switch (cmd) { |
180 | /* | 184 | /* |
181 | ** RIO_SET_TIMER | 185 | ** RIO_SET_TIMER |
182 | ** | 186 | ** |
183 | ** Change the value of the host card interrupt timer. | 187 | ** Change the value of the host card interrupt timer. |
184 | ** If the host card number is -1 then all host cards are changed | 188 | ** If the host card number is -1 then all host cards are changed |
185 | ** otherwise just the specified host card will be changed. | 189 | ** otherwise just the specified host card will be changed. |
186 | */ | 190 | */ |
187 | case RIO_SET_TIMER: | 191 | case RIO_SET_TIMER: |
188 | rio_dprintk (RIO_DEBUG_CTRL, "RIO_SET_TIMER to %dms\n", (uint)arg); | 192 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_SET_TIMER to %dms\n", (uint) arg); |
189 | { | 193 | { |
190 | int host, value; | 194 | int host, value; |
191 | host = (uint)arg >> 16; | 195 | host = (uint) arg >> 16; |
192 | value = (uint)arg & 0x0000ffff; | 196 | value = (uint) arg & 0x0000ffff; |
193 | if (host == -1) { | 197 | if (host == -1) { |
194 | for (host = 0; host < p->RIONumHosts; host++) { | 198 | for (host = 0; host < p->RIONumHosts; host++) { |
195 | if (p->RIOHosts[host].Flags == RC_RUNNING) { | 199 | if (p->RIOHosts[host].Flags == RC_RUNNING) { |
196 | WWORD(p->RIOHosts[host].ParmMapP->timer , value); | 200 | WWORD(p->RIOHosts[host].ParmMapP->timer, value); |
197 | } | ||
198 | } | ||
199 | } else if (host >= p->RIONumHosts) { | ||
200 | return -EINVAL; | ||
201 | } else { | ||
202 | if ( p->RIOHosts[host].Flags == RC_RUNNING ) { | ||
203 | WWORD(p->RIOHosts[host].ParmMapP->timer , value); | ||
204 | } | 201 | } |
205 | } | 202 | } |
206 | } | 203 | } else if (host >= p->RIONumHosts) { |
207 | return 0; | 204 | return -EINVAL; |
208 | 205 | } else { | |
209 | case RIO_IDENTIFY_DRIVER: | 206 | if (p->RIOHosts[host].Flags == RC_RUNNING) { |
210 | /* | 207 | WWORD(p->RIOHosts[host].ParmMapP->timer, value); |
211 | ** 15.10.1998 ARG - ESIL 0760 part fix | ||
212 | ** Added driver ident string output. | ||
213 | ** | ||
214 | #ifndef __THIS_RELEASE__ | ||
215 | #warning Driver Version string not defined ! | ||
216 | #endif | ||
217 | cprintf("%s %s %s %s\n", | ||
218 | RIO_DRV_STR, | ||
219 | __THIS_RELEASE__, | ||
220 | __DATE__, __TIME__ ); | ||
221 | |||
222 | return 0; | ||
223 | |||
224 | case RIO_DISPLAY_HOST_CFG: | ||
225 | ** | ||
226 | ** 15.10.1998 ARG - ESIL 0760 part fix | ||
227 | ** Added driver host card ident string output. | ||
228 | ** | ||
229 | ** Note that the only types currently supported | ||
230 | ** are ISA and PCI. Also this driver does not | ||
231 | ** (yet) distinguish between the Old PCI card | ||
232 | ** and the Jet PCI card. In fact I think this | ||
233 | ** driver only supports JET PCI ! | ||
234 | ** | ||
235 | |||
236 | for (Host = 0; Host < p->RIONumHosts; Host++) | ||
237 | { | ||
238 | HostP = &(p->RIOHosts[Host]); | ||
239 | |||
240 | switch ( HostP->Type ) | ||
241 | { | ||
242 | case RIO_AT : | ||
243 | strcpy( host_type, RIO_AT_HOST_STR ); | ||
244 | break; | ||
245 | |||
246 | case RIO_PCI : | ||
247 | strcpy( host_type, RIO_PCI_HOST_STR ); | ||
248 | break; | ||
249 | |||
250 | default : | ||
251 | strcpy( host_type, "Unknown" ); | ||
252 | break; | ||
253 | } | 208 | } |
209 | } | ||
210 | } | ||
211 | return 0; | ||
254 | 212 | ||
255 | cprintf( | 213 | case RIO_IDENTIFY_DRIVER: |
256 | "RIO Host %d - Type:%s Addr:%X IRQ:%d\n", | 214 | /* |
257 | Host, host_type, | 215 | ** 15.10.1998 ARG - ESIL 0760 part fix |
258 | (uint)HostP->PaddrP, | 216 | ** Added driver ident string output. |
259 | (int)HostP->Ivec - 32 ); | 217 | ** |
218 | #ifndef __THIS_RELEASE__ | ||
219 | #warning Driver Version string not defined ! | ||
220 | #endif | ||
221 | cprintf("%s %s %s %s\n", | ||
222 | RIO_DRV_STR, | ||
223 | __THIS_RELEASE__, | ||
224 | __DATE__, __TIME__ ); | ||
225 | |||
226 | return 0; | ||
227 | |||
228 | case RIO_DISPLAY_HOST_CFG: | ||
229 | ** | ||
230 | ** 15.10.1998 ARG - ESIL 0760 part fix | ||
231 | ** Added driver host card ident string output. | ||
232 | ** | ||
233 | ** Note that the only types currently supported | ||
234 | ** are ISA and PCI. Also this driver does not | ||
235 | ** (yet) distinguish between the Old PCI card | ||
236 | ** and the Jet PCI card. In fact I think this | ||
237 | ** driver only supports JET PCI ! | ||
238 | ** | ||
239 | |||
240 | for (Host = 0; Host < p->RIONumHosts; Host++) | ||
241 | { | ||
242 | HostP = &(p->RIOHosts[Host]); | ||
243 | |||
244 | switch ( HostP->Type ) | ||
245 | { | ||
246 | case RIO_AT : | ||
247 | strcpy( host_type, RIO_AT_HOST_STR ); | ||
248 | break; | ||
249 | |||
250 | case RIO_PCI : | ||
251 | strcpy( host_type, RIO_PCI_HOST_STR ); | ||
252 | break; | ||
253 | |||
254 | default : | ||
255 | strcpy( host_type, "Unknown" ); | ||
256 | break; | ||
257 | } | ||
258 | |||
259 | cprintf( | ||
260 | "RIO Host %d - Type:%s Addr:%X IRQ:%d\n", | ||
261 | Host, host_type, | ||
262 | (uint)HostP->PaddrP, | ||
263 | (int)HostP->Ivec - 32 ); | ||
264 | } | ||
265 | return 0; | ||
266 | ** | ||
267 | */ | ||
268 | |||
269 | case RIO_FOAD_RTA: | ||
270 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_FOAD_RTA\n"); | ||
271 | return RIOCommandRta(p, (uint) arg, RIOFoadRta); | ||
272 | |||
273 | case RIO_ZOMBIE_RTA: | ||
274 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_ZOMBIE_RTA\n"); | ||
275 | return RIOCommandRta(p, (uint) arg, RIOZombieRta); | ||
276 | |||
277 | case RIO_IDENTIFY_RTA: | ||
278 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_IDENTIFY_RTA\n"); | ||
279 | return RIOIdentifyRta(p, arg); | ||
280 | |||
281 | case RIO_KILL_NEIGHBOUR: | ||
282 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_KILL_NEIGHBOUR\n"); | ||
283 | return RIOKillNeighbour(p, arg); | ||
284 | |||
285 | case SPECIAL_RUP_CMD: | ||
286 | { | ||
287 | struct CmdBlk *CmdBlkP; | ||
288 | |||
289 | rio_dprintk(RIO_DEBUG_CTRL, "SPECIAL_RUP_CMD\n"); | ||
290 | if (copyin((int) arg, (caddr_t) & SpecialRupCmd, sizeof(SpecialRupCmd)) == COPYFAIL) { | ||
291 | rio_dprintk(RIO_DEBUG_CTRL, "SPECIAL_RUP_CMD copy failed\n"); | ||
292 | p->RIOError.Error = COPYIN_FAILED; | ||
293 | return -EFAULT; | ||
294 | } | ||
295 | CmdBlkP = RIOGetCmdBlk(); | ||
296 | if (!CmdBlkP) { | ||
297 | rio_dprintk(RIO_DEBUG_CTRL, "SPECIAL_RUP_CMD GetCmdBlk failed\n"); | ||
298 | return -ENXIO; | ||
299 | } | ||
300 | CmdBlkP->Packet = SpecialRupCmd.Packet; | ||
301 | if (SpecialRupCmd.Host >= p->RIONumHosts) | ||
302 | SpecialRupCmd.Host = 0; | ||
303 | rio_dprintk(RIO_DEBUG_CTRL, "Queue special rup command for host %d rup %d\n", SpecialRupCmd.Host, SpecialRupCmd.RupNum); | ||
304 | if (RIOQueueCmdBlk(&p->RIOHosts[SpecialRupCmd.Host], SpecialRupCmd.RupNum, CmdBlkP) == RIO_FAIL) { | ||
305 | cprintf("FAILED TO QUEUE SPECIAL RUP COMMAND\n"); | ||
260 | } | 306 | } |
261 | return 0; | 307 | return 0; |
262 | ** | 308 | } |
263 | */ | ||
264 | |||
265 | case RIO_FOAD_RTA: | ||
266 | rio_dprintk (RIO_DEBUG_CTRL, "RIO_FOAD_RTA\n"); | ||
267 | return RIOCommandRta(p, (uint)arg, RIOFoadRta); | ||
268 | |||
269 | case RIO_ZOMBIE_RTA: | ||
270 | rio_dprintk (RIO_DEBUG_CTRL, "RIO_ZOMBIE_RTA\n"); | ||
271 | return RIOCommandRta(p, (uint)arg, RIOZombieRta); | ||
272 | |||
273 | case RIO_IDENTIFY_RTA: | ||
274 | rio_dprintk (RIO_DEBUG_CTRL, "RIO_IDENTIFY_RTA\n"); | ||
275 | return RIOIdentifyRta(p, arg); | ||
276 | |||
277 | case RIO_KILL_NEIGHBOUR: | ||
278 | rio_dprintk (RIO_DEBUG_CTRL, "RIO_KILL_NEIGHBOUR\n"); | ||
279 | return RIOKillNeighbour(p, arg); | ||
280 | |||
281 | case SPECIAL_RUP_CMD: | ||
282 | { | ||
283 | struct CmdBlk *CmdBlkP; | ||
284 | |||
285 | rio_dprintk (RIO_DEBUG_CTRL, "SPECIAL_RUP_CMD\n"); | ||
286 | if (copyin((int)arg, (caddr_t)&SpecialRupCmd, | ||
287 | sizeof(SpecialRupCmd)) == COPYFAIL ) { | ||
288 | rio_dprintk (RIO_DEBUG_CTRL, "SPECIAL_RUP_CMD copy failed\n"); | ||
289 | p->RIOError.Error = COPYIN_FAILED; | ||
290 | return -EFAULT; | ||
291 | } | ||
292 | CmdBlkP = RIOGetCmdBlk(); | ||
293 | if ( !CmdBlkP ) { | ||
294 | rio_dprintk (RIO_DEBUG_CTRL, "SPECIAL_RUP_CMD GetCmdBlk failed\n"); | ||
295 | return -ENXIO; | ||
296 | } | ||
297 | CmdBlkP->Packet = SpecialRupCmd.Packet; | ||
298 | if ( SpecialRupCmd.Host >= p->RIONumHosts ) | ||
299 | SpecialRupCmd.Host = 0; | ||
300 | rio_dprintk (RIO_DEBUG_CTRL, "Queue special rup command for host %d rup %d\n", | ||
301 | SpecialRupCmd.Host, SpecialRupCmd.RupNum); | ||
302 | if (RIOQueueCmdBlk(&p->RIOHosts[SpecialRupCmd.Host], | ||
303 | SpecialRupCmd.RupNum, CmdBlkP) == RIO_FAIL) { | ||
304 | cprintf("FAILED TO QUEUE SPECIAL RUP COMMAND\n"); | ||
305 | } | ||
306 | return 0; | ||
307 | } | ||
308 | 309 | ||
309 | case RIO_DEBUG_MEM: | 310 | case RIO_DEBUG_MEM: |
310 | #ifdef DEBUG_MEM_SUPPORT | 311 | #ifdef DEBUG_MEM_SUPPORT |
311 | RIO_DEBUG_CTRL, if (su) | 312 | RIO_DEBUG_CTRL, if (su) |
312 | return rio_RIODebugMemory(RIO_DEBUG_CTRL, arg); | 313 | return rio_RIODebugMemory(RIO_DEBUG_CTRL, arg); |
313 | else | 314 | else |
314 | #endif | 315 | #endif |
315 | return -EPERM; | 316 | return -EPERM; |
316 | |||
317 | case RIO_ALL_MODEM: | ||
318 | rio_dprintk (RIO_DEBUG_CTRL, "RIO_ALL_MODEM\n"); | ||
319 | p->RIOError.Error = IOCTL_COMMAND_UNKNOWN; | ||
320 | return -EINVAL; | ||
321 | |||
322 | case RIO_GET_TABLE: | ||
323 | /* | ||
324 | ** Read the routing table from the device driver to user space | ||
325 | */ | ||
326 | rio_dprintk (RIO_DEBUG_CTRL, "RIO_GET_TABLE\n"); | ||
327 | 317 | ||
328 | if ((retval = RIOApel(p)) != 0) | 318 | case RIO_ALL_MODEM: |
329 | return retval; | 319 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_ALL_MODEM\n"); |
320 | p->RIOError.Error = IOCTL_COMMAND_UNKNOWN; | ||
321 | return -EINVAL; | ||
330 | 322 | ||
331 | if (copyout((caddr_t)p->RIOConnectTable, (int)arg, | 323 | case RIO_GET_TABLE: |
332 | TOTAL_MAP_ENTRIES*sizeof(struct Map)) == COPYFAIL) { | 324 | /* |
333 | rio_dprintk (RIO_DEBUG_CTRL, "RIO_GET_TABLE copy failed\n"); | 325 | ** Read the routing table from the device driver to user space |
334 | p->RIOError.Error = COPYOUT_FAILED; | 326 | */ |
335 | return -EFAULT; | 327 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_GET_TABLE\n"); |
336 | } | 328 | |
329 | if ((retval = RIOApel(p)) != 0) | ||
330 | return retval; | ||
331 | |||
332 | if (copyout((caddr_t) p->RIOConnectTable, (int) arg, TOTAL_MAP_ENTRIES * sizeof(struct Map)) == COPYFAIL) { | ||
333 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_GET_TABLE copy failed\n"); | ||
334 | p->RIOError.Error = COPYOUT_FAILED; | ||
335 | return -EFAULT; | ||
336 | } | ||
337 | |||
338 | { | ||
339 | int entry; | ||
340 | rio_dprintk(RIO_DEBUG_CTRL, "*****\nMAP ENTRIES\n"); | ||
341 | for (entry = 0; entry < TOTAL_MAP_ENTRIES; entry++) { | ||
342 | if ((p->RIOConnectTable[entry].ID == 0) && (p->RIOConnectTable[entry].HostUniqueNum == 0) && (p->RIOConnectTable[entry].RtaUniqueNum == 0)) | ||
343 | continue; | ||
344 | |||
345 | rio_dprintk(RIO_DEBUG_CTRL, "Map entry %d.HostUniqueNum = 0x%x\n", entry, p->RIOConnectTable[entry].HostUniqueNum); | ||
346 | rio_dprintk(RIO_DEBUG_CTRL, "Map entry %d.RtaUniqueNum = 0x%x\n", entry, p->RIOConnectTable[entry].RtaUniqueNum); | ||
347 | rio_dprintk(RIO_DEBUG_CTRL, "Map entry %d.ID = 0x%x\n", entry, p->RIOConnectTable[entry].ID); | ||
348 | rio_dprintk(RIO_DEBUG_CTRL, "Map entry %d.ID2 = 0x%x\n", entry, p->RIOConnectTable[entry].ID2); | ||
349 | rio_dprintk(RIO_DEBUG_CTRL, "Map entry %d.Flags = 0x%x\n", entry, (int) p->RIOConnectTable[entry].Flags); | ||
350 | rio_dprintk(RIO_DEBUG_CTRL, "Map entry %d.SysPort = 0x%x\n", entry, (int) p->RIOConnectTable[entry].SysPort); | ||
351 | rio_dprintk(RIO_DEBUG_CTRL, "Map entry %d.Top[0].Unit = %x\n", entry, p->RIOConnectTable[entry].Topology[0].Unit); | ||
352 | rio_dprintk(RIO_DEBUG_CTRL, "Map entry %d.Top[0].Link = %x\n", entry, p->RIOConnectTable[entry].Topology[0].Link); | ||
353 | rio_dprintk(RIO_DEBUG_CTRL, "Map entry %d.Top[1].Unit = %x\n", entry, p->RIOConnectTable[entry].Topology[1].Unit); | ||
354 | rio_dprintk(RIO_DEBUG_CTRL, "Map entry %d.Top[1].Link = %x\n", entry, p->RIOConnectTable[entry].Topology[1].Link); | ||
355 | rio_dprintk(RIO_DEBUG_CTRL, "Map entry %d.Top[2].Unit = %x\n", entry, p->RIOConnectTable[entry].Topology[2].Unit); | ||
356 | rio_dprintk(RIO_DEBUG_CTRL, "Map entry %d.Top[2].Link = %x\n", entry, p->RIOConnectTable[entry].Topology[2].Link); | ||
357 | rio_dprintk(RIO_DEBUG_CTRL, "Map entry %d.Top[3].Unit = %x\n", entry, p->RIOConnectTable[entry].Topology[3].Unit); | ||
358 | rio_dprintk(RIO_DEBUG_CTRL, "Map entry %d.Top[4].Link = %x\n", entry, p->RIOConnectTable[entry].Topology[3].Link); | ||
359 | rio_dprintk(RIO_DEBUG_CTRL, "Map entry %d.Name = %s\n", entry, p->RIOConnectTable[entry].Name); | ||
360 | } | ||
361 | rio_dprintk(RIO_DEBUG_CTRL, "*****\nEND MAP ENTRIES\n"); | ||
362 | } | ||
363 | p->RIOQuickCheck = NOT_CHANGED; /* a table has been gotten */ | ||
364 | return 0; | ||
337 | 365 | ||
338 | { | 366 | case RIO_PUT_TABLE: |
339 | int entry; | 367 | /* |
340 | rio_dprintk (RIO_DEBUG_CTRL, "*****\nMAP ENTRIES\n"); | 368 | ** Write the routing table to the device driver from user space |
341 | for ( entry=0; entry<TOTAL_MAP_ENTRIES; entry++ ) | 369 | */ |
342 | { | 370 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_PUT_TABLE\n"); |
343 | if ((p->RIOConnectTable[entry].ID == 0) && | 371 | |
344 | (p->RIOConnectTable[entry].HostUniqueNum == 0) && | 372 | if (!su) { |
345 | (p->RIOConnectTable[entry].RtaUniqueNum == 0)) continue; | 373 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_PUT_TABLE !Root\n"); |
346 | 374 | p->RIOError.Error = NOT_SUPER_USER; | |
347 | rio_dprintk (RIO_DEBUG_CTRL, "Map entry %d.HostUniqueNum = 0x%x\n", entry, p->RIOConnectTable[entry].HostUniqueNum ); | 375 | return -EPERM; |
348 | rio_dprintk (RIO_DEBUG_CTRL, "Map entry %d.RtaUniqueNum = 0x%x\n", entry, p->RIOConnectTable[entry].RtaUniqueNum ); | 376 | } |
349 | rio_dprintk (RIO_DEBUG_CTRL, "Map entry %d.ID = 0x%x\n", entry, p->RIOConnectTable[entry].ID ); | 377 | if (copyin((int) arg, (caddr_t) & p->RIOConnectTable[0], TOTAL_MAP_ENTRIES * sizeof(struct Map)) == COPYFAIL) { |
350 | rio_dprintk (RIO_DEBUG_CTRL, "Map entry %d.ID2 = 0x%x\n", entry, p->RIOConnectTable[entry].ID2 ); | 378 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_PUT_TABLE copy failed\n"); |
351 | rio_dprintk (RIO_DEBUG_CTRL, "Map entry %d.Flags = 0x%x\n", entry, (int)p->RIOConnectTable[entry].Flags ); | 379 | p->RIOError.Error = COPYIN_FAILED; |
352 | rio_dprintk (RIO_DEBUG_CTRL, "Map entry %d.SysPort = 0x%x\n", entry, (int)p->RIOConnectTable[entry].SysPort ); | 380 | return -EFAULT; |
353 | rio_dprintk (RIO_DEBUG_CTRL, "Map entry %d.Top[0].Unit = %x\n", entry, p->RIOConnectTable[entry].Topology[0].Unit ); | 381 | } |
354 | rio_dprintk (RIO_DEBUG_CTRL, "Map entry %d.Top[0].Link = %x\n", entry, p->RIOConnectTable[entry].Topology[0].Link ); | ||
355 | rio_dprintk (RIO_DEBUG_CTRL, "Map entry %d.Top[1].Unit = %x\n", entry, p->RIOConnectTable[entry].Topology[1].Unit ); | ||
356 | rio_dprintk (RIO_DEBUG_CTRL, "Map entry %d.Top[1].Link = %x\n", entry, p->RIOConnectTable[entry].Topology[1].Link ); | ||
357 | rio_dprintk (RIO_DEBUG_CTRL, "Map entry %d.Top[2].Unit = %x\n", entry, p->RIOConnectTable[entry].Topology[2].Unit ); | ||
358 | rio_dprintk (RIO_DEBUG_CTRL, "Map entry %d.Top[2].Link = %x\n", entry, p->RIOConnectTable[entry].Topology[2].Link ); | ||
359 | rio_dprintk (RIO_DEBUG_CTRL, "Map entry %d.Top[3].Unit = %x\n", entry, p->RIOConnectTable[entry].Topology[3].Unit ); | ||
360 | rio_dprintk (RIO_DEBUG_CTRL, "Map entry %d.Top[4].Link = %x\n", entry, p->RIOConnectTable[entry].Topology[3].Link ); | ||
361 | rio_dprintk (RIO_DEBUG_CTRL, "Map entry %d.Name = %s\n", entry, p->RIOConnectTable[entry].Name ); | ||
362 | } | ||
363 | rio_dprintk (RIO_DEBUG_CTRL, "*****\nEND MAP ENTRIES\n"); | ||
364 | } | ||
365 | p->RIOQuickCheck = NOT_CHANGED; /* a table has been gotten */ | ||
366 | return 0; | ||
367 | |||
368 | case RIO_PUT_TABLE: | ||
369 | /* | ||
370 | ** Write the routing table to the device driver from user space | ||
371 | */ | ||
372 | rio_dprintk (RIO_DEBUG_CTRL, "RIO_PUT_TABLE\n"); | ||
373 | |||
374 | if ( !su ) { | ||
375 | rio_dprintk (RIO_DEBUG_CTRL, "RIO_PUT_TABLE !Root\n"); | ||
376 | p->RIOError.Error = NOT_SUPER_USER; | ||
377 | return -EPERM; | ||
378 | } | ||
379 | if ( copyin((int)arg, (caddr_t)&p->RIOConnectTable[0], | ||
380 | TOTAL_MAP_ENTRIES*sizeof(struct Map) ) == COPYFAIL ) { | ||
381 | rio_dprintk (RIO_DEBUG_CTRL, "RIO_PUT_TABLE copy failed\n"); | ||
382 | p->RIOError.Error = COPYIN_FAILED; | ||
383 | return -EFAULT; | ||
384 | } | ||
385 | /* | 382 | /* |
386 | *********************************** | 383 | *********************************** |
387 | { | 384 | { |
@@ -409,1353 +406,1244 @@ RIO_DEBUG_CTRL, if (su) | |||
409 | } | 406 | } |
410 | *********************************** | 407 | *********************************** |
411 | */ | 408 | */ |
412 | return RIONewTable(p); | 409 | return RIONewTable(p); |
413 | |||
414 | case RIO_GET_BINDINGS : | ||
415 | /* | ||
416 | ** Send bindings table, containing unique numbers of RTAs owned | ||
417 | ** by this system to user space | ||
418 | */ | ||
419 | rio_dprintk (RIO_DEBUG_CTRL, "RIO_GET_BINDINGS\n"); | ||
420 | 410 | ||
421 | if ( !su ) | 411 | case RIO_GET_BINDINGS: |
422 | { | 412 | /* |
423 | rio_dprintk (RIO_DEBUG_CTRL, "RIO_GET_BINDINGS !Root\n"); | 413 | ** Send bindings table, containing unique numbers of RTAs owned |
424 | p->RIOError.Error = NOT_SUPER_USER; | 414 | ** by this system to user space |
425 | return -EPERM; | 415 | */ |
426 | } | 416 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_GET_BINDINGS\n"); |
427 | if (copyout((caddr_t) p->RIOBindTab, (int)arg, | 417 | |
428 | (sizeof(ulong) * MAX_RTA_BINDINGS)) == COPYFAIL ) { | 418 | if (!su) { |
429 | rio_dprintk (RIO_DEBUG_CTRL, "RIO_GET_BINDINGS copy failed\n"); | 419 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_GET_BINDINGS !Root\n"); |
430 | p->RIOError.Error = COPYOUT_FAILED; | 420 | p->RIOError.Error = NOT_SUPER_USER; |
431 | return -EFAULT; | 421 | return -EPERM; |
432 | } | 422 | } |
433 | return 0; | 423 | if (copyout((caddr_t) p->RIOBindTab, (int) arg, (sizeof(ulong) * MAX_RTA_BINDINGS)) == COPYFAIL) { |
434 | 424 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_GET_BINDINGS copy failed\n"); | |
435 | case RIO_PUT_BINDINGS : | 425 | p->RIOError.Error = COPYOUT_FAILED; |
426 | return -EFAULT; | ||
427 | } | ||
428 | return 0; | ||
429 | |||
430 | case RIO_PUT_BINDINGS: | ||
431 | /* | ||
432 | ** Receive a bindings table, containing unique numbers of RTAs owned | ||
433 | ** by this system | ||
434 | */ | ||
435 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_PUT_BINDINGS\n"); | ||
436 | |||
437 | if (!su) { | ||
438 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_PUT_BINDINGS !Root\n"); | ||
439 | p->RIOError.Error = NOT_SUPER_USER; | ||
440 | return -EPERM; | ||
441 | } | ||
442 | if (copyin((int) arg, (caddr_t) & p->RIOBindTab[0], (sizeof(ulong) * MAX_RTA_BINDINGS)) == COPYFAIL) { | ||
443 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_PUT_BINDINGS copy failed\n"); | ||
444 | p->RIOError.Error = COPYIN_FAILED; | ||
445 | return -EFAULT; | ||
446 | } | ||
447 | return 0; | ||
448 | |||
449 | case RIO_BIND_RTA: | ||
450 | { | ||
451 | int EmptySlot = -1; | ||
436 | /* | 452 | /* |
437 | ** Receive a bindings table, containing unique numbers of RTAs owned | 453 | ** Bind this RTA to host, so that it will be booted by |
438 | ** by this system | 454 | ** host in 'boot owned RTAs' mode. |
439 | */ | 455 | */ |
440 | rio_dprintk (RIO_DEBUG_CTRL, "RIO_PUT_BINDINGS\n"); | 456 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_BIND_RTA\n"); |
441 | 457 | ||
442 | if ( !su ) | 458 | if (!su) { |
443 | { | 459 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_BIND_RTA !Root\n"); |
444 | rio_dprintk (RIO_DEBUG_CTRL, "RIO_PUT_BINDINGS !Root\n"); | 460 | p->RIOError.Error = NOT_SUPER_USER; |
445 | p->RIOError.Error = NOT_SUPER_USER; | 461 | return -EPERM; |
446 | return -EPERM; | 462 | } |
447 | } | 463 | for (Entry = 0; Entry < MAX_RTA_BINDINGS; Entry++) { |
448 | if (copyin((int)arg, (caddr_t)&p->RIOBindTab[0], | 464 | if ((EmptySlot == -1) && (p->RIOBindTab[Entry] == 0L)) |
449 | (sizeof(ulong) * MAX_RTA_BINDINGS))==COPYFAIL ) { | 465 | EmptySlot = Entry; |
450 | rio_dprintk (RIO_DEBUG_CTRL, "RIO_PUT_BINDINGS copy failed\n"); | 466 | else if (p->RIOBindTab[Entry] == (int) arg) { |
451 | p->RIOError.Error = COPYIN_FAILED; | ||
452 | return -EFAULT; | ||
453 | } | ||
454 | return 0; | ||
455 | |||
456 | case RIO_BIND_RTA : | ||
457 | { | ||
458 | int EmptySlot = -1; | ||
459 | /* | ||
460 | ** Bind this RTA to host, so that it will be booted by | ||
461 | ** host in 'boot owned RTAs' mode. | ||
462 | */ | ||
463 | rio_dprintk (RIO_DEBUG_CTRL, "RIO_BIND_RTA\n"); | ||
464 | |||
465 | if ( !su ) { | ||
466 | rio_dprintk (RIO_DEBUG_CTRL, "RIO_BIND_RTA !Root\n"); | ||
467 | p->RIOError.Error = NOT_SUPER_USER; | ||
468 | return -EPERM; | ||
469 | } | ||
470 | for (Entry = 0; Entry < MAX_RTA_BINDINGS; Entry++) { | ||
471 | if ((EmptySlot == -1) && (p->RIOBindTab[Entry] == 0L)) | ||
472 | EmptySlot = Entry; | ||
473 | else if (p->RIOBindTab[Entry] == (int) arg) { | ||
474 | /* | ||
475 | ** Already exists - delete | ||
476 | */ | ||
477 | p->RIOBindTab[Entry] = 0L; | ||
478 | rio_dprintk (RIO_DEBUG_CTRL, "Removing Rta %x from p->RIOBindTab\n", | ||
479 | (int) arg); | ||
480 | return 0; | ||
481 | } | ||
482 | } | ||
483 | /* | 467 | /* |
484 | ** Dosen't exist - add | 468 | ** Already exists - delete |
485 | */ | 469 | */ |
486 | if (EmptySlot != -1) { | 470 | p->RIOBindTab[Entry] = 0L; |
487 | p->RIOBindTab[EmptySlot] = (int) arg; | 471 | rio_dprintk(RIO_DEBUG_CTRL, "Removing Rta %x from p->RIOBindTab\n", (int) arg); |
488 | rio_dprintk (RIO_DEBUG_CTRL, "Adding Rta %x to p->RIOBindTab\n", | ||
489 | (int) arg); | ||
490 | } | ||
491 | else { | ||
492 | rio_dprintk (RIO_DEBUG_CTRL, "p->RIOBindTab full! - Rta %x not added\n", | ||
493 | (int) arg); | ||
494 | return -ENOMEM; | ||
495 | } | ||
496 | return 0; | 472 | return 0; |
497 | } | 473 | } |
498 | 474 | } | |
499 | case RIO_RESUME : | 475 | /* |
500 | rio_dprintk (RIO_DEBUG_CTRL, "RIO_RESUME\n"); | 476 | ** Dosen't exist - add |
501 | port = (uint) arg; | 477 | */ |
502 | if ((port < 0) || (port > 511)) { | 478 | if (EmptySlot != -1) { |
503 | rio_dprintk (RIO_DEBUG_CTRL, "RIO_RESUME: Bad port number %d\n", port); | 479 | p->RIOBindTab[EmptySlot] = (int) arg; |
504 | p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE; | 480 | rio_dprintk(RIO_DEBUG_CTRL, "Adding Rta %x to p->RIOBindTab\n", (int) arg); |
505 | return -EINVAL; | 481 | } else { |
506 | } | 482 | rio_dprintk(RIO_DEBUG_CTRL, "p->RIOBindTab full! - Rta %x not added\n", (int) arg); |
507 | PortP = p->RIOPortp[port]; | 483 | return -ENOMEM; |
508 | if (!PortP->Mapped) { | 484 | } |
509 | rio_dprintk (RIO_DEBUG_CTRL, "RIO_RESUME: Port %d not mapped\n", port); | 485 | return 0; |
510 | p->RIOError.Error = PORT_NOT_MAPPED_INTO_SYSTEM; | 486 | } |
511 | return -EINVAL; | 487 | |
512 | } | 488 | case RIO_RESUME: |
513 | if (!(PortP->State & (RIO_LOPEN | RIO_MOPEN))) { | 489 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_RESUME\n"); |
514 | rio_dprintk (RIO_DEBUG_CTRL, "RIO_RESUME: Port %d not open\n", port); | 490 | port = (uint) arg; |
515 | return -EINVAL; | 491 | if ((port < 0) || (port > 511)) { |
516 | } | 492 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_RESUME: Bad port number %d\n", port); |
517 | 493 | p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE; | |
518 | rio_spin_lock_irqsave(&PortP->portSem, flags); | 494 | return -EINVAL; |
519 | if (RIOPreemptiveCmd(p, (p->RIOPortp[port]), RESUME) == | 495 | } |
520 | RIO_FAIL) { | 496 | PortP = p->RIOPortp[port]; |
521 | rio_dprintk (RIO_DEBUG_CTRL, "RIO_RESUME failed\n"); | 497 | if (!PortP->Mapped) { |
522 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | 498 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_RESUME: Port %d not mapped\n", port); |
523 | return -EBUSY; | 499 | p->RIOError.Error = PORT_NOT_MAPPED_INTO_SYSTEM; |
524 | } | 500 | return -EINVAL; |
525 | else { | 501 | } |
526 | rio_dprintk (RIO_DEBUG_CTRL, "RIO_RESUME: Port %d resumed\n", port); | 502 | if (!(PortP->State & (RIO_LOPEN | RIO_MOPEN))) { |
527 | PortP->State |= RIO_BUSY; | 503 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_RESUME: Port %d not open\n", port); |
528 | } | 504 | return -EINVAL; |
529 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | 505 | } |
530 | return retval; | 506 | |
531 | 507 | rio_spin_lock_irqsave(&PortP->portSem, flags); | |
532 | case RIO_ASSIGN_RTA: | 508 | if (RIOPreemptiveCmd(p, (p->RIOPortp[port]), RESUME) == RIO_FAIL) { |
533 | rio_dprintk (RIO_DEBUG_CTRL, "RIO_ASSIGN_RTA\n"); | 509 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_RESUME failed\n"); |
534 | if ( !su ) { | 510 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); |
535 | rio_dprintk (RIO_DEBUG_CTRL, "RIO_ASSIGN_RTA !Root\n"); | 511 | return -EBUSY; |
536 | p->RIOError.Error = NOT_SUPER_USER; | 512 | } else { |
537 | return -EPERM; | 513 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_RESUME: Port %d resumed\n", port); |
538 | } | 514 | PortP->State |= RIO_BUSY; |
539 | if (copyin((int)arg, (caddr_t)&MapEnt, sizeof(MapEnt)) | 515 | } |
540 | == COPYFAIL) { | 516 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); |
541 | rio_dprintk (RIO_DEBUG_CTRL, "Copy from user space failed\n"); | 517 | return retval; |
542 | p->RIOError.Error = COPYIN_FAILED; | 518 | |
543 | return -EFAULT; | 519 | case RIO_ASSIGN_RTA: |
544 | } | 520 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_ASSIGN_RTA\n"); |
545 | return RIOAssignRta(p, &MapEnt); | 521 | if (!su) { |
546 | 522 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_ASSIGN_RTA !Root\n"); | |
547 | case RIO_CHANGE_NAME: | 523 | p->RIOError.Error = NOT_SUPER_USER; |
548 | rio_dprintk (RIO_DEBUG_CTRL, "RIO_CHANGE_NAME\n"); | 524 | return -EPERM; |
549 | if ( !su ) { | 525 | } |
550 | rio_dprintk (RIO_DEBUG_CTRL, "RIO_CHANGE_NAME !Root\n"); | 526 | if (copyin((int) arg, (caddr_t) & MapEnt, sizeof(MapEnt)) |
551 | p->RIOError.Error = NOT_SUPER_USER; | 527 | == COPYFAIL) { |
552 | return -EPERM; | 528 | rio_dprintk(RIO_DEBUG_CTRL, "Copy from user space failed\n"); |
553 | } | 529 | p->RIOError.Error = COPYIN_FAILED; |
554 | if (copyin((int)arg, (caddr_t)&MapEnt, sizeof(MapEnt)) | 530 | return -EFAULT; |
555 | == COPYFAIL) { | 531 | } |
556 | rio_dprintk (RIO_DEBUG_CTRL, "Copy from user space failed\n"); | 532 | return RIOAssignRta(p, &MapEnt); |
557 | p->RIOError.Error = COPYIN_FAILED; | 533 | |
558 | return -EFAULT; | 534 | case RIO_CHANGE_NAME: |
559 | } | 535 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_CHANGE_NAME\n"); |
560 | return RIOChangeName(p, &MapEnt); | 536 | if (!su) { |
561 | 537 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_CHANGE_NAME !Root\n"); | |
562 | case RIO_DELETE_RTA: | 538 | p->RIOError.Error = NOT_SUPER_USER; |
563 | rio_dprintk (RIO_DEBUG_CTRL, "RIO_DELETE_RTA\n"); | 539 | return -EPERM; |
564 | if ( !su ) { | 540 | } |
565 | rio_dprintk (RIO_DEBUG_CTRL, "RIO_DELETE_RTA !Root\n"); | 541 | if (copyin((int) arg, (caddr_t) & MapEnt, sizeof(MapEnt)) |
566 | p->RIOError.Error = NOT_SUPER_USER; | 542 | == COPYFAIL) { |
567 | return -EPERM; | 543 | rio_dprintk(RIO_DEBUG_CTRL, "Copy from user space failed\n"); |
568 | } | 544 | p->RIOError.Error = COPYIN_FAILED; |
569 | if (copyin((int)arg, (caddr_t)&MapEnt, sizeof(MapEnt)) | 545 | return -EFAULT; |
570 | == COPYFAIL ) { | 546 | } |
571 | rio_dprintk (RIO_DEBUG_CTRL, "Copy from data space failed\n"); | 547 | return RIOChangeName(p, &MapEnt); |
572 | p->RIOError.Error = COPYIN_FAILED; | 548 | |
573 | return -EFAULT; | 549 | case RIO_DELETE_RTA: |
574 | } | 550 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_DELETE_RTA\n"); |
575 | return RIODeleteRta(p, &MapEnt); | 551 | if (!su) { |
576 | 552 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_DELETE_RTA !Root\n"); | |
577 | case RIO_QUICK_CHECK: | 553 | p->RIOError.Error = NOT_SUPER_USER; |
578 | /* | 554 | return -EPERM; |
579 | ** 09.12.1998 ARG - ESIL 0776 part fix | 555 | } |
580 | ** A customer was using this to get the RTAs | 556 | if (copyin((int) arg, (caddr_t) & MapEnt, sizeof(MapEnt)) |
581 | ** connect/disconnect status. | 557 | == COPYFAIL) { |
582 | ** RIOConCon() had been botched use RIOHalted | 558 | rio_dprintk(RIO_DEBUG_CTRL, "Copy from data space failed\n"); |
583 | ** to keep track of RTA connections and | 559 | p->RIOError.Error = COPYIN_FAILED; |
584 | ** disconnections. That has been changed and | 560 | return -EFAULT; |
585 | ** RIORtaDisCons in the rio_info struct now | 561 | } |
586 | ** does the job. So we need to return the value | 562 | return RIODeleteRta(p, &MapEnt); |
587 | ** of RIORtaCons instead of RIOHalted. | 563 | |
588 | ** | 564 | case RIO_QUICK_CHECK: |
589 | if (copyout((caddr_t)&p->RIOHalted,(int)arg, | 565 | /* |
590 | sizeof(uint))==COPYFAIL) { | 566 | ** 09.12.1998 ARG - ESIL 0776 part fix |
591 | ** | 567 | ** A customer was using this to get the RTAs |
592 | */ | 568 | ** connect/disconnect status. |
593 | 569 | ** RIOConCon() had been botched use RIOHalted | |
594 | if (copyout((caddr_t)&p->RIORtaDisCons,(int)arg, | 570 | ** to keep track of RTA connections and |
595 | sizeof(uint))==COPYFAIL) { | 571 | ** disconnections. That has been changed and |
596 | p->RIOError.Error = COPYOUT_FAILED; | 572 | ** RIORtaDisCons in the rio_info struct now |
597 | return -EFAULT; | 573 | ** does the job. So we need to return the value |
598 | } | 574 | ** of RIORtaCons instead of RIOHalted. |
599 | return 0; | 575 | ** |
600 | 576 | if (copyout((caddr_t)&p->RIOHalted,(int)arg, | |
601 | case RIO_LAST_ERROR: | 577 | sizeof(uint))==COPYFAIL) { |
602 | if (copyout((caddr_t)&p->RIOError, (int)arg, | 578 | ** |
603 | sizeof(struct Error)) ==COPYFAIL ) | 579 | */ |
604 | return -EFAULT; | 580 | |
605 | return 0; | 581 | if (copyout((caddr_t) & p->RIORtaDisCons, (int) arg, sizeof(uint)) == COPYFAIL) { |
606 | 582 | p->RIOError.Error = COPYOUT_FAILED; | |
607 | case RIO_GET_LOG: | 583 | return -EFAULT; |
608 | rio_dprintk (RIO_DEBUG_CTRL, "RIO_GET_LOG\n"); | 584 | } |
585 | return 0; | ||
586 | |||
587 | case RIO_LAST_ERROR: | ||
588 | if (copyout((caddr_t) & p->RIOError, (int) arg, sizeof(struct Error)) == COPYFAIL) | ||
589 | return -EFAULT; | ||
590 | return 0; | ||
591 | |||
592 | case RIO_GET_LOG: | ||
593 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_GET_LOG\n"); | ||
609 | #ifdef LOGGING | 594 | #ifdef LOGGING |
610 | RIOGetLog(arg); | 595 | RIOGetLog(arg); |
611 | return 0; | 596 | return 0; |
612 | #else | 597 | #else |
613 | return -EINVAL; | 598 | return -EINVAL; |
614 | #endif | 599 | #endif |
615 | 600 | ||
616 | case RIO_GET_MODTYPE: | 601 | case RIO_GET_MODTYPE: |
617 | if ( copyin( (int)arg, (caddr_t)&port, | 602 | if (copyin((int) arg, (caddr_t) & port, sizeof(uint)) == COPYFAIL) { |
618 | sizeof(uint)) == COPYFAIL ) | 603 | p->RIOError.Error = COPYIN_FAILED; |
619 | { | 604 | return -EFAULT; |
620 | p->RIOError.Error = COPYIN_FAILED; | 605 | } |
621 | return -EFAULT; | 606 | rio_dprintk(RIO_DEBUG_CTRL, "Get module type for port %d\n", port); |
622 | } | 607 | if (port < 0 || port > 511) { |
623 | rio_dprintk (RIO_DEBUG_CTRL, "Get module type for port %d\n", port); | 608 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_GET_MODTYPE: Bad port number %d\n", port); |
624 | if ( port < 0 || port > 511 ) | 609 | p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE; |
625 | { | 610 | return -EINVAL; |
626 | rio_dprintk (RIO_DEBUG_CTRL, "RIO_GET_MODTYPE: Bad port number %d\n", port); | 611 | } |
627 | p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE; | 612 | PortP = (p->RIOPortp[port]); |
628 | return -EINVAL; | 613 | if (!PortP->Mapped) { |
629 | } | 614 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_GET_MODTYPE: Port %d not mapped\n", port); |
630 | PortP = (p->RIOPortp[port]); | 615 | p->RIOError.Error = PORT_NOT_MAPPED_INTO_SYSTEM; |
631 | if (!PortP->Mapped) | 616 | return -EINVAL; |
632 | { | 617 | } |
633 | rio_dprintk (RIO_DEBUG_CTRL, "RIO_GET_MODTYPE: Port %d not mapped\n", port); | 618 | /* |
634 | p->RIOError.Error = PORT_NOT_MAPPED_INTO_SYSTEM; | 619 | ** Return module type of port |
635 | return -EINVAL; | 620 | */ |
636 | } | 621 | port = PortP->HostP->UnixRups[PortP->RupNum].ModTypes; |
637 | /* | 622 | if (copyout((caddr_t) & port, (int) arg, sizeof(uint)) == COPYFAIL) { |
638 | ** Return module type of port | 623 | p->RIOError.Error = COPYOUT_FAILED; |
639 | */ | 624 | return -EFAULT; |
640 | port = PortP->HostP->UnixRups[PortP->RupNum].ModTypes; | 625 | } |
641 | if (copyout((caddr_t)&port, (int)arg, | 626 | return (0); |
642 | sizeof(uint)) == COPYFAIL) { | 627 | /* |
643 | p->RIOError.Error = COPYOUT_FAILED; | 628 | ** 02.03.1999 ARG - ESIL 0820 fix |
644 | return -EFAULT; | 629 | ** We are no longer using "Boot Mode", so these ioctls |
645 | } | 630 | ** are not required : |
646 | return(0); | 631 | ** |
647 | /* | 632 | case RIO_GET_BOOT_MODE : |
648 | ** 02.03.1999 ARG - ESIL 0820 fix | 633 | rio_dprint(RIO_DEBUG_CTRL, ("Get boot mode - %x\n", p->RIOBootMode)); |
649 | ** We are no longer using "Boot Mode", so these ioctls | 634 | ** |
650 | ** are not required : | 635 | ** Return boot state of system - BOOT_ALL, BOOT_OWN or BOOT_NONE |
651 | ** | 636 | ** |
652 | case RIO_GET_BOOT_MODE : | 637 | if (copyout((caddr_t)&p->RIOBootMode, (int)arg, |
653 | rio_dprint(RIO_DEBUG_CTRL, ("Get boot mode - %x\n", p->RIOBootMode)); | 638 | sizeof(p->RIOBootMode)) == COPYFAIL) { |
654 | ** | 639 | p->RIOError.Error = COPYOUT_FAILED; |
655 | ** Return boot state of system - BOOT_ALL, BOOT_OWN or BOOT_NONE | 640 | return -EFAULT; |
656 | ** | 641 | } |
657 | if (copyout((caddr_t)&p->RIOBootMode, (int)arg, | 642 | return(0); |
658 | sizeof(p->RIOBootMode)) == COPYFAIL) { | 643 | |
659 | p->RIOError.Error = COPYOUT_FAILED; | 644 | case RIO_SET_BOOT_MODE : |
660 | return -EFAULT; | 645 | p->RIOBootMode = (uint) arg; |
661 | } | 646 | rio_dprint(RIO_DEBUG_CTRL, ("Set boot mode to 0x%x\n", p->RIOBootMode)); |
662 | return(0); | 647 | return(0); |
663 | 648 | ** | |
664 | case RIO_SET_BOOT_MODE : | 649 | ** End ESIL 0820 fix |
665 | p->RIOBootMode = (uint) arg; | 650 | */ |
666 | rio_dprint(RIO_DEBUG_CTRL, ("Set boot mode to 0x%x\n", p->RIOBootMode)); | 651 | |
667 | return(0); | 652 | case RIO_BLOCK_OPENS: |
668 | ** | 653 | rio_dprintk(RIO_DEBUG_CTRL, "Opens block until booted\n"); |
669 | ** End ESIL 0820 fix | 654 | for (Entry = 0; Entry < RIO_PORTS; Entry++) { |
670 | */ | 655 | rio_spin_lock_irqsave(&PortP->portSem, flags); |
671 | 656 | p->RIOPortp[Entry]->WaitUntilBooted = 1; | |
672 | case RIO_BLOCK_OPENS: | 657 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); |
673 | rio_dprintk (RIO_DEBUG_CTRL, "Opens block until booted\n"); | 658 | } |
674 | for ( Entry=0; Entry < RIO_PORTS; Entry++ ) { | 659 | return 0; |
675 | rio_spin_lock_irqsave(&PortP->portSem, flags); | 660 | |
676 | p->RIOPortp[Entry]->WaitUntilBooted = 1; | 661 | case RIO_SETUP_PORTS: |
677 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | 662 | rio_dprintk(RIO_DEBUG_CTRL, "Setup ports\n"); |
678 | } | 663 | if (copyin((int) arg, (caddr_t) & PortSetup, sizeof(PortSetup)) |
679 | return 0; | 664 | == COPYFAIL) { |
680 | 665 | p->RIOError.Error = COPYIN_FAILED; | |
681 | case RIO_SETUP_PORTS: | 666 | rio_dprintk(RIO_DEBUG_CTRL, "EFAULT"); |
682 | rio_dprintk (RIO_DEBUG_CTRL, "Setup ports\n"); | 667 | return -EFAULT; |
683 | if (copyin((int)arg, (caddr_t)&PortSetup, sizeof(PortSetup)) | 668 | } |
684 | == COPYFAIL ) { | 669 | if (PortSetup.From > PortSetup.To || PortSetup.To >= RIO_PORTS) { |
685 | p->RIOError.Error = COPYIN_FAILED; | 670 | p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE; |
686 | rio_dprintk (RIO_DEBUG_CTRL, "EFAULT"); | 671 | rio_dprintk(RIO_DEBUG_CTRL, "ENXIO"); |
687 | return -EFAULT; | 672 | return -ENXIO; |
688 | } | 673 | } |
689 | if ( PortSetup.From > PortSetup.To || | 674 | if (PortSetup.XpCps > p->RIOConf.MaxXpCps || PortSetup.XpCps < p->RIOConf.MinXpCps) { |
690 | PortSetup.To >= RIO_PORTS ) { | 675 | p->RIOError.Error = XPRINT_CPS_OUT_OF_RANGE; |
691 | p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE; | 676 | rio_dprintk(RIO_DEBUG_CTRL, "EINVAL"); |
692 | rio_dprintk (RIO_DEBUG_CTRL, "ENXIO"); | 677 | return -EINVAL; |
693 | return -ENXIO; | 678 | } |
694 | } | 679 | if (!p->RIOPortp) { |
695 | if ( PortSetup.XpCps > p->RIOConf.MaxXpCps || | 680 | cprintf("No p->RIOPortp array!\n"); |
696 | PortSetup.XpCps < p->RIOConf.MinXpCps ) { | 681 | rio_dprintk(RIO_DEBUG_CTRL, "No p->RIOPortp array!\n"); |
697 | p->RIOError.Error = XPRINT_CPS_OUT_OF_RANGE; | 682 | return -EIO; |
698 | rio_dprintk (RIO_DEBUG_CTRL, "EINVAL"); | 683 | } |
699 | return -EINVAL; | 684 | rio_dprintk(RIO_DEBUG_CTRL, "entering loop (%d %d)!\n", PortSetup.From, PortSetup.To); |
700 | } | 685 | for (loop = PortSetup.From; loop <= PortSetup.To; loop++) { |
701 | if ( !p->RIOPortp ) { | 686 | rio_dprintk(RIO_DEBUG_CTRL, "in loop (%d)!\n", loop); |
702 | cprintf("No p->RIOPortp array!\n"); | ||
703 | rio_dprintk (RIO_DEBUG_CTRL, "No p->RIOPortp array!\n"); | ||
704 | return -EIO; | ||
705 | } | ||
706 | rio_dprintk (RIO_DEBUG_CTRL, "entering loop (%d %d)!\n", PortSetup.From, PortSetup.To); | ||
707 | for (loop=PortSetup.From; loop<=PortSetup.To; loop++) { | ||
708 | rio_dprintk (RIO_DEBUG_CTRL, "in loop (%d)!\n", loop); | ||
709 | #if 0 | 687 | #if 0 |
710 | PortP = p->RIOPortp[loop]; | 688 | PortP = p->RIOPortp[loop]; |
711 | if ( !PortP->TtyP ) | 689 | if (!PortP->TtyP) |
712 | PortP->TtyP = &p->channel[loop]; | 690 | PortP->TtyP = &p->channel[loop]; |
713 | 691 | ||
714 | rio_spin_lock_irqsave(&PortP->portSem, flags); | 692 | rio_spin_lock_irqsave(&PortP->portSem, flags); |
715 | if ( PortSetup.IxAny ) | 693 | if (PortSetup.IxAny) |
716 | PortP->Config |= RIO_IXANY; | 694 | PortP->Config |= RIO_IXANY; |
717 | else | 695 | else |
718 | PortP->Config &= ~RIO_IXANY; | 696 | PortP->Config &= ~RIO_IXANY; |
719 | if ( PortSetup.IxOn ) | 697 | if (PortSetup.IxOn) |
720 | PortP->Config |= RIO_IXON; | 698 | PortP->Config |= RIO_IXON; |
721 | else | 699 | else |
722 | PortP->Config &= ~RIO_IXON; | 700 | PortP->Config &= ~RIO_IXON; |
723 | |||
724 | /* | ||
725 | ** If the port needs to wait for all a processes output | ||
726 | ** to drain before closing then this flag will be set. | ||
727 | */ | ||
728 | if (PortSetup.Drain) { | ||
729 | PortP->Config |= RIO_WAITDRAIN; | ||
730 | } else { | ||
731 | PortP->Config &= ~RIO_WAITDRAIN; | ||
732 | } | ||
733 | /* | ||
734 | ** Store settings if locking or unlocking port or if the | ||
735 | ** port is not locked, when setting the store option. | ||
736 | */ | ||
737 | if (PortP->Mapped && | ||
738 | ((PortSetup.Lock && !PortP->Lock) || | ||
739 | (!PortP->Lock && | ||
740 | (PortSetup.Store && !PortP->Store)))) { | ||
741 | PortP->StoredTty.iflag = PortP->TtyP->tm.c_iflag; | ||
742 | PortP->StoredTty.oflag = PortP->TtyP->tm.c_oflag; | ||
743 | PortP->StoredTty.cflag = PortP->TtyP->tm.c_cflag; | ||
744 | PortP->StoredTty.lflag = PortP->TtyP->tm.c_lflag; | ||
745 | PortP->StoredTty.line = PortP->TtyP->tm.c_line; | ||
746 | bcopy(PortP->TtyP->tm.c_cc, PortP->StoredTty.cc, | ||
747 | NCC + 5); | ||
748 | } | ||
749 | PortP->Lock = PortSetup.Lock; | ||
750 | PortP->Store = PortSetup.Store; | ||
751 | PortP->Xprint.XpCps = PortSetup.XpCps; | ||
752 | bcopy(PortSetup.XpOn,PortP->Xprint.XpOn,MAX_XP_CTRL_LEN); | ||
753 | bcopy(PortSetup.XpOff,PortP->Xprint.XpOff,MAX_XP_CTRL_LEN); | ||
754 | PortP->Xprint.XpOn[MAX_XP_CTRL_LEN-1] = '\0'; | ||
755 | PortP->Xprint.XpOff[MAX_XP_CTRL_LEN-1] = '\0'; | ||
756 | PortP->Xprint.XpLen = RIOStrlen(PortP->Xprint.XpOn)+ | ||
757 | RIOStrlen(PortP->Xprint.XpOff); | ||
758 | rio_spin_unlock_irqrestore( &PortP->portSem , flags); | ||
759 | #endif | ||
760 | } | ||
761 | rio_dprintk (RIO_DEBUG_CTRL, "after loop (%d)!\n", loop); | ||
762 | rio_dprintk (RIO_DEBUG_CTRL, "Retval:%x\n", retval); | ||
763 | return retval; | ||
764 | |||
765 | case RIO_GET_PORT_SETUP : | ||
766 | rio_dprintk (RIO_DEBUG_CTRL, "Get port setup\n"); | ||
767 | if (copyin((int)arg, (caddr_t)&PortSetup, sizeof(PortSetup)) | ||
768 | == COPYFAIL ) { | ||
769 | p->RIOError.Error = COPYIN_FAILED; | ||
770 | return -EFAULT; | ||
771 | } | ||
772 | if ( PortSetup.From >= RIO_PORTS ) { | ||
773 | p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE; | ||
774 | return -ENXIO; | ||
775 | } | ||
776 | 701 | ||
777 | port = PortSetup.To = PortSetup.From; | 702 | /* |
778 | PortSetup.IxAny = (p->RIOPortp[port]->Config & RIO_IXANY) ? | 703 | ** If the port needs to wait for all a processes output |
779 | 1 : 0; | 704 | ** to drain before closing then this flag will be set. |
780 | PortSetup.IxOn = (p->RIOPortp[port]->Config & RIO_IXON) ? | 705 | */ |
781 | 1 : 0; | 706 | if (PortSetup.Drain) { |
782 | PortSetup.Drain = (p->RIOPortp[port]->Config & RIO_WAITDRAIN) ? | 707 | PortP->Config |= RIO_WAITDRAIN; |
783 | 1 : 0; | 708 | } else { |
784 | PortSetup.Store = p->RIOPortp[port]->Store; | 709 | PortP->Config &= ~RIO_WAITDRAIN; |
785 | PortSetup.Lock = p->RIOPortp[port]->Lock; | 710 | } |
786 | PortSetup.XpCps = p->RIOPortp[port]->Xprint.XpCps; | 711 | /* |
787 | bcopy(p->RIOPortp[port]->Xprint.XpOn, PortSetup.XpOn, | 712 | ** Store settings if locking or unlocking port or if the |
788 | MAX_XP_CTRL_LEN); | 713 | ** port is not locked, when setting the store option. |
789 | bcopy(p->RIOPortp[port]->Xprint.XpOff, PortSetup.XpOff, | 714 | */ |
790 | MAX_XP_CTRL_LEN); | 715 | if (PortP->Mapped && ((PortSetup.Lock && !PortP->Lock) || (!PortP->Lock && (PortSetup.Store && !PortP->Store)))) { |
791 | PortSetup.XpOn[MAX_XP_CTRL_LEN-1] = '\0'; | 716 | PortP->StoredTty.iflag = PortP->TtyP->tm.c_iflag; |
792 | PortSetup.XpOff[MAX_XP_CTRL_LEN-1] = '\0'; | 717 | PortP->StoredTty.oflag = PortP->TtyP->tm.c_oflag; |
793 | 718 | PortP->StoredTty.cflag = PortP->TtyP->tm.c_cflag; | |
794 | if ( copyout((caddr_t)&PortSetup,(int)arg,sizeof(PortSetup)) | 719 | PortP->StoredTty.lflag = PortP->TtyP->tm.c_lflag; |
795 | ==COPYFAIL ) { | 720 | PortP->StoredTty.line = PortP->TtyP->tm.c_line; |
796 | p->RIOError.Error = COPYOUT_FAILED; | 721 | bcopy(PortP->TtyP->tm.c_cc, PortP->StoredTty.cc, NCC + 5); |
797 | return -EFAULT; | 722 | } |
798 | } | 723 | PortP->Lock = PortSetup.Lock; |
799 | return retval; | 724 | PortP->Store = PortSetup.Store; |
800 | 725 | PortP->Xprint.XpCps = PortSetup.XpCps; | |
801 | case RIO_GET_PORT_PARAMS : | 726 | bcopy(PortSetup.XpOn, PortP->Xprint.XpOn, MAX_XP_CTRL_LEN); |
802 | rio_dprintk (RIO_DEBUG_CTRL, "Get port params\n"); | 727 | bcopy(PortSetup.XpOff, PortP->Xprint.XpOff, MAX_XP_CTRL_LEN); |
803 | if (copyin( (int)arg, (caddr_t)&PortParams, | 728 | PortP->Xprint.XpOn[MAX_XP_CTRL_LEN - 1] = '\0'; |
804 | sizeof(struct PortParams)) == COPYFAIL) { | 729 | PortP->Xprint.XpOff[MAX_XP_CTRL_LEN - 1] = '\0'; |
805 | p->RIOError.Error = COPYIN_FAILED; | 730 | PortP->Xprint.XpLen = RIOStrlen(PortP->Xprint.XpOn) + RIOStrlen(PortP->Xprint.XpOff); |
806 | return -EFAULT; | 731 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); |
807 | } | 732 | #endif |
808 | if (PortParams.Port >= RIO_PORTS) { | 733 | } |
809 | p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE; | 734 | rio_dprintk(RIO_DEBUG_CTRL, "after loop (%d)!\n", loop); |
810 | return -ENXIO; | 735 | rio_dprintk(RIO_DEBUG_CTRL, "Retval:%x\n", retval); |
811 | } | 736 | return retval; |
812 | PortP = (p->RIOPortp[PortParams.Port]); | 737 | |
813 | PortParams.Config = PortP->Config; | 738 | case RIO_GET_PORT_SETUP: |
814 | PortParams.State = PortP->State; | 739 | rio_dprintk(RIO_DEBUG_CTRL, "Get port setup\n"); |
815 | rio_dprintk (RIO_DEBUG_CTRL, "Port %d\n", PortParams.Port); | 740 | if (copyin((int) arg, (caddr_t) & PortSetup, sizeof(PortSetup)) |
816 | 741 | == COPYFAIL) { | |
817 | if (copyout((caddr_t)&PortParams, (int)arg, | 742 | p->RIOError.Error = COPYIN_FAILED; |
818 | sizeof(struct PortParams)) == COPYFAIL ) { | 743 | return -EFAULT; |
819 | p->RIOError.Error = COPYOUT_FAILED; | 744 | } |
820 | return -EFAULT; | 745 | if (PortSetup.From >= RIO_PORTS) { |
821 | } | 746 | p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE; |
822 | return retval; | 747 | return -ENXIO; |
823 | 748 | } | |
824 | case RIO_GET_PORT_TTY : | 749 | |
825 | rio_dprintk (RIO_DEBUG_CTRL, "Get port tty\n"); | 750 | port = PortSetup.To = PortSetup.From; |
826 | if (copyin((int)arg, (caddr_t)&PortTty, sizeof(struct PortTty)) | 751 | PortSetup.IxAny = (p->RIOPortp[port]->Config & RIO_IXANY) ? 1 : 0; |
827 | == COPYFAIL) { | 752 | PortSetup.IxOn = (p->RIOPortp[port]->Config & RIO_IXON) ? 1 : 0; |
828 | p->RIOError.Error = COPYIN_FAILED; | 753 | PortSetup.Drain = (p->RIOPortp[port]->Config & RIO_WAITDRAIN) ? 1 : 0; |
829 | return -EFAULT; | 754 | PortSetup.Store = p->RIOPortp[port]->Store; |
830 | } | 755 | PortSetup.Lock = p->RIOPortp[port]->Lock; |
831 | if ( PortTty.port >= RIO_PORTS ) { | 756 | PortSetup.XpCps = p->RIOPortp[port]->Xprint.XpCps; |
832 | p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE; | 757 | bcopy(p->RIOPortp[port]->Xprint.XpOn, PortSetup.XpOn, MAX_XP_CTRL_LEN); |
833 | return -ENXIO; | 758 | bcopy(p->RIOPortp[port]->Xprint.XpOff, PortSetup.XpOff, MAX_XP_CTRL_LEN); |
834 | } | 759 | PortSetup.XpOn[MAX_XP_CTRL_LEN - 1] = '\0'; |
835 | 760 | PortSetup.XpOff[MAX_XP_CTRL_LEN - 1] = '\0'; | |
836 | rio_dprintk (RIO_DEBUG_CTRL, "Port %d\n", PortTty.port); | 761 | |
837 | PortP = (p->RIOPortp[PortTty.port]); | 762 | if (copyout((caddr_t) & PortSetup, (int) arg, sizeof(PortSetup)) |
763 | == COPYFAIL) { | ||
764 | p->RIOError.Error = COPYOUT_FAILED; | ||
765 | return -EFAULT; | ||
766 | } | ||
767 | return retval; | ||
768 | |||
769 | case RIO_GET_PORT_PARAMS: | ||
770 | rio_dprintk(RIO_DEBUG_CTRL, "Get port params\n"); | ||
771 | if (copyin((int) arg, (caddr_t) & PortParams, sizeof(struct PortParams)) == COPYFAIL) { | ||
772 | p->RIOError.Error = COPYIN_FAILED; | ||
773 | return -EFAULT; | ||
774 | } | ||
775 | if (PortParams.Port >= RIO_PORTS) { | ||
776 | p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE; | ||
777 | return -ENXIO; | ||
778 | } | ||
779 | PortP = (p->RIOPortp[PortParams.Port]); | ||
780 | PortParams.Config = PortP->Config; | ||
781 | PortParams.State = PortP->State; | ||
782 | rio_dprintk(RIO_DEBUG_CTRL, "Port %d\n", PortParams.Port); | ||
783 | |||
784 | if (copyout((caddr_t) & PortParams, (int) arg, sizeof(struct PortParams)) == COPYFAIL) { | ||
785 | p->RIOError.Error = COPYOUT_FAILED; | ||
786 | return -EFAULT; | ||
787 | } | ||
788 | return retval; | ||
789 | |||
790 | case RIO_GET_PORT_TTY: | ||
791 | rio_dprintk(RIO_DEBUG_CTRL, "Get port tty\n"); | ||
792 | if (copyin((int) arg, (caddr_t) & PortTty, sizeof(struct PortTty)) | ||
793 | == COPYFAIL) { | ||
794 | p->RIOError.Error = COPYIN_FAILED; | ||
795 | return -EFAULT; | ||
796 | } | ||
797 | if (PortTty.port >= RIO_PORTS) { | ||
798 | p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE; | ||
799 | return -ENXIO; | ||
800 | } | ||
801 | |||
802 | rio_dprintk(RIO_DEBUG_CTRL, "Port %d\n", PortTty.port); | ||
803 | PortP = (p->RIOPortp[PortTty.port]); | ||
838 | #if 0 | 804 | #if 0 |
839 | PortTty.Tty.tm.c_iflag = PortP->TtyP->tm.c_iflag; | 805 | PortTty.Tty.tm.c_iflag = PortP->TtyP->tm.c_iflag; |
840 | PortTty.Tty.tm.c_oflag = PortP->TtyP->tm.c_oflag; | 806 | PortTty.Tty.tm.c_oflag = PortP->TtyP->tm.c_oflag; |
841 | PortTty.Tty.tm.c_cflag = PortP->TtyP->tm.c_cflag; | 807 | PortTty.Tty.tm.c_cflag = PortP->TtyP->tm.c_cflag; |
842 | PortTty.Tty.tm.c_lflag = PortP->TtyP->tm.c_lflag; | 808 | PortTty.Tty.tm.c_lflag = PortP->TtyP->tm.c_lflag; |
843 | #endif | 809 | #endif |
844 | if (copyout((caddr_t)&PortTty, (int)arg, | 810 | if (copyout((caddr_t) & PortTty, (int) arg, sizeof(struct PortTty)) == COPYFAIL) { |
845 | sizeof(struct PortTty)) == COPYFAIL) { | 811 | p->RIOError.Error = COPYOUT_FAILED; |
846 | p->RIOError.Error = COPYOUT_FAILED; | 812 | return -EFAULT; |
847 | return -EFAULT; | 813 | } |
848 | } | 814 | return retval; |
849 | return retval; | 815 | |
850 | 816 | case RIO_SET_PORT_TTY: | |
851 | case RIO_SET_PORT_TTY : | 817 | if (copyin((int) arg, (caddr_t) & PortTty, sizeof(struct PortTty)) == COPYFAIL) { |
852 | if (copyin((int)arg, (caddr_t)&PortTty, | 818 | p->RIOError.Error = COPYIN_FAILED; |
853 | sizeof(struct PortTty)) == COPYFAIL) { | 819 | return -EFAULT; |
854 | p->RIOError.Error = COPYIN_FAILED; | 820 | } |
855 | return -EFAULT; | 821 | rio_dprintk(RIO_DEBUG_CTRL, "Set port %d tty\n", PortTty.port); |
856 | } | 822 | if (PortTty.port >= (ushort) RIO_PORTS) { |
857 | rio_dprintk (RIO_DEBUG_CTRL, "Set port %d tty\n", PortTty.port); | 823 | p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE; |
858 | if (PortTty.port >= (ushort) RIO_PORTS) { | 824 | return -ENXIO; |
859 | p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE; | 825 | } |
860 | return -ENXIO; | 826 | PortP = (p->RIOPortp[PortTty.port]); |
861 | } | ||
862 | PortP = (p->RIOPortp[PortTty.port]); | ||
863 | #if 0 | 827 | #if 0 |
864 | rio_spin_lock_irqsave(&PortP->portSem, flags); | 828 | rio_spin_lock_irqsave(&PortP->portSem, flags); |
865 | PortP->TtyP->tm.c_iflag = PortTty.Tty.tm.c_iflag; | 829 | PortP->TtyP->tm.c_iflag = PortTty.Tty.tm.c_iflag; |
866 | PortP->TtyP->tm.c_oflag = PortTty.Tty.tm.c_oflag; | 830 | PortP->TtyP->tm.c_oflag = PortTty.Tty.tm.c_oflag; |
867 | PortP->TtyP->tm.c_cflag = PortTty.Tty.tm.c_cflag; | 831 | PortP->TtyP->tm.c_cflag = PortTty.Tty.tm.c_cflag; |
868 | PortP->TtyP->tm.c_lflag = PortTty.Tty.tm.c_lflag; | 832 | PortP->TtyP->tm.c_lflag = PortTty.Tty.tm.c_lflag; |
869 | rio_spin_unlock_irqrestore( &PortP->portSem , flags); | 833 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); |
870 | #endif | 834 | #endif |
871 | 835 | ||
872 | RIOParam(PortP, CONFIG, PortP->State & RIO_MODEM, OK_TO_SLEEP); | 836 | RIOParam(PortP, CONFIG, PortP->State & RIO_MODEM, OK_TO_SLEEP); |
873 | return retval; | 837 | return retval; |
874 | 838 | ||
875 | case RIO_SET_PORT_PARAMS : | 839 | case RIO_SET_PORT_PARAMS: |
876 | rio_dprintk (RIO_DEBUG_CTRL, "Set port params\n"); | 840 | rio_dprintk(RIO_DEBUG_CTRL, "Set port params\n"); |
877 | if ( copyin((int)arg, (caddr_t)&PortParams, sizeof(PortParams)) | 841 | if (copyin((int) arg, (caddr_t) & PortParams, sizeof(PortParams)) |
878 | == COPYFAIL ) { | 842 | == COPYFAIL) { |
879 | p->RIOError.Error = COPYIN_FAILED; | 843 | p->RIOError.Error = COPYIN_FAILED; |
880 | return -EFAULT; | 844 | return -EFAULT; |
881 | } | 845 | } |
882 | if (PortParams.Port >= (ushort) RIO_PORTS) { | 846 | if (PortParams.Port >= (ushort) RIO_PORTS) { |
883 | p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE; | 847 | p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE; |
884 | return -ENXIO; | 848 | return -ENXIO; |
885 | } | 849 | } |
886 | PortP = (p->RIOPortp[PortParams.Port]); | 850 | PortP = (p->RIOPortp[PortParams.Port]); |
887 | rio_spin_lock_irqsave(&PortP->portSem, flags); | 851 | rio_spin_lock_irqsave(&PortP->portSem, flags); |
888 | PortP->Config = PortParams.Config; | 852 | PortP->Config = PortParams.Config; |
889 | rio_spin_unlock_irqrestore( &PortP->portSem , flags); | 853 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); |
890 | return retval; | 854 | return retval; |
891 | 855 | ||
892 | case RIO_GET_PORT_STATS : | 856 | case RIO_GET_PORT_STATS: |
893 | rio_dprintk (RIO_DEBUG_CTRL, "RIO_GET_PORT_STATS\n"); | 857 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_GET_PORT_STATS\n"); |
894 | if ( copyin((int)arg, (caddr_t)&portStats, | 858 | if (copyin((int) arg, (caddr_t) & portStats, sizeof(struct portStats)) == COPYFAIL) { |
895 | sizeof(struct portStats)) == COPYFAIL ) { | 859 | p->RIOError.Error = COPYIN_FAILED; |
896 | p->RIOError.Error = COPYIN_FAILED; | 860 | return -EFAULT; |
897 | return -EFAULT; | 861 | } |
898 | } | 862 | if (portStats.port >= RIO_PORTS) { |
899 | if ( portStats.port >= RIO_PORTS ) { | 863 | p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE; |
900 | p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE; | 864 | return -ENXIO; |
901 | return -ENXIO; | 865 | } |
902 | } | 866 | PortP = (p->RIOPortp[portStats.port]); |
903 | PortP = (p->RIOPortp[portStats.port]); | 867 | portStats.gather = PortP->statsGather; |
904 | portStats.gather = PortP->statsGather; | 868 | portStats.txchars = PortP->txchars; |
905 | portStats.txchars = PortP->txchars; | 869 | portStats.rxchars = PortP->rxchars; |
906 | portStats.rxchars = PortP->rxchars; | 870 | portStats.opens = PortP->opens; |
907 | portStats.opens = PortP->opens; | 871 | portStats.closes = PortP->closes; |
908 | portStats.closes = PortP->closes; | 872 | portStats.ioctls = PortP->ioctls; |
909 | portStats.ioctls = PortP->ioctls; | 873 | if (copyout((caddr_t) & portStats, (int) arg, sizeof(struct portStats)) == COPYFAIL) { |
910 | if ( copyout((caddr_t)&portStats, (int)arg, | 874 | p->RIOError.Error = COPYOUT_FAILED; |
911 | sizeof(struct portStats)) == COPYFAIL ) { | 875 | return -EFAULT; |
912 | p->RIOError.Error = COPYOUT_FAILED; | 876 | } |
913 | return -EFAULT; | 877 | return retval; |
914 | } | 878 | |
915 | return retval; | 879 | case RIO_RESET_PORT_STATS: |
916 | 880 | port = (uint) arg; | |
917 | case RIO_RESET_PORT_STATS : | 881 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_RESET_PORT_STATS\n"); |
918 | port = (uint) arg; | 882 | if (port >= RIO_PORTS) { |
919 | rio_dprintk (RIO_DEBUG_CTRL, "RIO_RESET_PORT_STATS\n"); | 883 | p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE; |
920 | if ( port >= RIO_PORTS ) { | 884 | return -ENXIO; |
921 | p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE; | 885 | } |
922 | return -ENXIO; | 886 | PortP = (p->RIOPortp[port]); |
923 | } | 887 | rio_spin_lock_irqsave(&PortP->portSem, flags); |
924 | PortP = (p->RIOPortp[port]); | 888 | PortP->txchars = 0; |
925 | rio_spin_lock_irqsave(&PortP->portSem, flags); | 889 | PortP->rxchars = 0; |
926 | PortP->txchars = 0; | 890 | PortP->opens = 0; |
927 | PortP->rxchars = 0; | 891 | PortP->closes = 0; |
928 | PortP->opens = 0; | 892 | PortP->ioctls = 0; |
929 | PortP->closes = 0; | 893 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); |
930 | PortP->ioctls = 0; | 894 | return retval; |
931 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | 895 | |
932 | return retval; | 896 | case RIO_GATHER_PORT_STATS: |
933 | 897 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_GATHER_PORT_STATS\n"); | |
934 | case RIO_GATHER_PORT_STATS : | 898 | if (copyin((int) arg, (caddr_t) & portStats, sizeof(struct portStats)) == COPYFAIL) { |
935 | rio_dprintk (RIO_DEBUG_CTRL, "RIO_GATHER_PORT_STATS\n"); | 899 | p->RIOError.Error = COPYIN_FAILED; |
936 | if ( copyin( (int)arg, (caddr_t)&portStats, | 900 | return -EFAULT; |
937 | sizeof(struct portStats)) == COPYFAIL ) { | 901 | } |
938 | p->RIOError.Error = COPYIN_FAILED; | 902 | if (portStats.port >= RIO_PORTS) { |
939 | return -EFAULT; | 903 | p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE; |
940 | } | 904 | return -ENXIO; |
941 | if ( portStats.port >= RIO_PORTS ) { | 905 | } |
942 | p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE; | 906 | PortP = (p->RIOPortp[portStats.port]); |
943 | return -ENXIO; | 907 | rio_spin_lock_irqsave(&PortP->portSem, flags); |
944 | } | 908 | PortP->statsGather = portStats.gather; |
945 | PortP = (p->RIOPortp[portStats.port]); | 909 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); |
946 | rio_spin_lock_irqsave(&PortP->portSem, flags); | 910 | return retval; |
947 | PortP->statsGather = portStats.gather; | ||
948 | rio_spin_unlock_irqrestore( &PortP->portSem , flags); | ||
949 | return retval; | ||
950 | 911 | ||
951 | #ifdef DEBUG_SUPPORTED | 912 | #ifdef DEBUG_SUPPORTED |
952 | case RIO_READ_LEVELS: | 913 | case RIO_READ_LEVELS: |
953 | { | 914 | { |
954 | int num; | 915 | int num; |
955 | rio_dprintk (RIO_DEBUG_CTRL, "RIO_READ_LEVELS\n"); | 916 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_READ_LEVELS\n"); |
956 | for ( num=0; RIODbInf[num].Flag; num++ ) ; | 917 | for (num = 0; RIODbInf[num].Flag; num++); |
957 | rio_dprintk (RIO_DEBUG_CTRL, "%d levels to copy\n",num); | 918 | rio_dprintk(RIO_DEBUG_CTRL, "%d levels to copy\n", num); |
958 | if (copyout((caddr_t)RIODbInf,(int)arg, | 919 | if (copyout((caddr_t) RIODbInf, (int) arg, sizeof(struct DbInf) * (num + 1)) == COPYFAIL) { |
959 | sizeof(struct DbInf)*(num+1))==COPYFAIL) { | 920 | rio_dprintk(RIO_DEBUG_CTRL, "ReadLevels Copy failed\n"); |
960 | rio_dprintk (RIO_DEBUG_CTRL, "ReadLevels Copy failed\n"); | 921 | p->RIOError.Error = COPYOUT_FAILED; |
961 | p->RIOError.Error = COPYOUT_FAILED; | 922 | return -EFAULT; |
962 | return -EFAULT; | 923 | } |
963 | } | 924 | rio_dprintk(RIO_DEBUG_CTRL, "%d levels to copied\n", num); |
964 | rio_dprintk (RIO_DEBUG_CTRL, "%d levels to copied\n",num); | 925 | return retval; |
965 | return retval; | 926 | } |
966 | } | ||
967 | #endif | 927 | #endif |
968 | 928 | ||
969 | case RIO_READ_CONFIG: | 929 | case RIO_READ_CONFIG: |
970 | rio_dprintk (RIO_DEBUG_CTRL, "RIO_READ_CONFIG\n"); | 930 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_READ_CONFIG\n"); |
971 | if (copyout((caddr_t)&p->RIOConf, (int)arg, | 931 | if (copyout((caddr_t) & p->RIOConf, (int) arg, sizeof(struct Conf)) == COPYFAIL) { |
972 | sizeof(struct Conf)) ==COPYFAIL ) { | 932 | p->RIOError.Error = COPYOUT_FAILED; |
973 | p->RIOError.Error = COPYOUT_FAILED; | 933 | return -EFAULT; |
974 | return -EFAULT; | 934 | } |
975 | } | 935 | return retval; |
976 | return retval; | 936 | |
977 | 937 | case RIO_SET_CONFIG: | |
978 | case RIO_SET_CONFIG: | 938 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_SET_CONFIG\n"); |
979 | rio_dprintk (RIO_DEBUG_CTRL, "RIO_SET_CONFIG\n"); | 939 | if (!su) { |
980 | if ( !su ) { | 940 | p->RIOError.Error = NOT_SUPER_USER; |
981 | p->RIOError.Error = NOT_SUPER_USER; | 941 | return -EPERM; |
982 | return -EPERM; | 942 | } |
943 | if (copyin((int) arg, (caddr_t) & p->RIOConf, sizeof(struct Conf)) | ||
944 | == COPYFAIL) { | ||
945 | p->RIOError.Error = COPYIN_FAILED; | ||
946 | return -EFAULT; | ||
947 | } | ||
948 | /* | ||
949 | ** move a few value around | ||
950 | */ | ||
951 | for (Host = 0; Host < p->RIONumHosts; Host++) | ||
952 | if ((p->RIOHosts[Host].Flags & RUN_STATE) == RC_RUNNING) | ||
953 | WWORD(p->RIOHosts[Host].ParmMapP->timer, p->RIOConf.Timer); | ||
954 | return retval; | ||
955 | |||
956 | case RIO_START_POLLER: | ||
957 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_START_POLLER\n"); | ||
958 | return -EINVAL; | ||
959 | |||
960 | case RIO_STOP_POLLER: | ||
961 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_STOP_POLLER\n"); | ||
962 | if (!su) { | ||
963 | p->RIOError.Error = NOT_SUPER_USER; | ||
964 | return -EPERM; | ||
965 | } | ||
966 | p->RIOPolling = NOT_POLLING; | ||
967 | return retval; | ||
968 | |||
969 | case RIO_SETDEBUG: | ||
970 | case RIO_GETDEBUG: | ||
971 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_SETDEBUG/RIO_GETDEBUG\n"); | ||
972 | if (copyin((int) arg, (caddr_t) & DebugCtrl, sizeof(DebugCtrl)) | ||
973 | == COPYFAIL) { | ||
974 | p->RIOError.Error = COPYIN_FAILED; | ||
975 | return -EFAULT; | ||
976 | } | ||
977 | if (DebugCtrl.SysPort == NO_PORT) { | ||
978 | if (cmd == RIO_SETDEBUG) { | ||
979 | if (!su) { | ||
980 | p->RIOError.Error = NOT_SUPER_USER; | ||
981 | return -EPERM; | ||
983 | } | 982 | } |
984 | if ( copyin((int)arg, (caddr_t)&p->RIOConf, sizeof(struct Conf) ) | 983 | p->rio_debug = DebugCtrl.Debug; |
985 | ==COPYFAIL ) { | 984 | p->RIODebugWait = DebugCtrl.Wait; |
986 | p->RIOError.Error = COPYIN_FAILED; | 985 | rio_dprintk(RIO_DEBUG_CTRL, "Set global debug to 0x%x set wait to 0x%x\n", p->rio_debug, p->RIODebugWait); |
987 | return -EFAULT; | 986 | } else { |
987 | rio_dprintk(RIO_DEBUG_CTRL, "Get global debug 0x%x wait 0x%x\n", p->rio_debug, p->RIODebugWait); | ||
988 | DebugCtrl.Debug = p->rio_debug; | ||
989 | DebugCtrl.Wait = p->RIODebugWait; | ||
990 | if (copyout((caddr_t) & DebugCtrl, (int) arg, sizeof(DebugCtrl)) == COPYFAIL) { | ||
991 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_SET/GET DEBUG: bad port number %d\n", DebugCtrl.SysPort); | ||
992 | p->RIOError.Error = COPYOUT_FAILED; | ||
993 | return -EFAULT; | ||
988 | } | 994 | } |
989 | /* | 995 | } |
990 | ** move a few value around | 996 | } else if (DebugCtrl.SysPort >= RIO_PORTS && DebugCtrl.SysPort != NO_PORT) { |
991 | */ | 997 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_SET/GET DEBUG: bad port number %d\n", DebugCtrl.SysPort); |
992 | for (Host=0; Host < p->RIONumHosts; Host++) | 998 | p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE; |
993 | if ( (p->RIOHosts[Host].Flags & RUN_STATE) == RC_RUNNING ) | 999 | return -ENXIO; |
994 | WWORD(p->RIOHosts[Host].ParmMapP->timer , | 1000 | } else if (cmd == RIO_SETDEBUG) { |
995 | p->RIOConf.Timer); | 1001 | if (!su) { |
996 | return retval; | 1002 | p->RIOError.Error = NOT_SUPER_USER; |
997 | 1003 | return -EPERM; | |
998 | case RIO_START_POLLER: | 1004 | } |
999 | rio_dprintk (RIO_DEBUG_CTRL, "RIO_START_POLLER\n"); | 1005 | rio_spin_lock_irqsave(&PortP->portSem, flags); |
1000 | return -EINVAL; | 1006 | p->RIOPortp[DebugCtrl.SysPort]->Debug = DebugCtrl.Debug; |
1007 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | ||
1008 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_SETDEBUG 0x%x\n", p->RIOPortp[DebugCtrl.SysPort]->Debug); | ||
1009 | } else { | ||
1010 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_GETDEBUG 0x%x\n", p->RIOPortp[DebugCtrl.SysPort]->Debug); | ||
1011 | DebugCtrl.Debug = p->RIOPortp[DebugCtrl.SysPort]->Debug; | ||
1012 | if (copyout((caddr_t) & DebugCtrl, (int) arg, sizeof(DebugCtrl)) == COPYFAIL) { | ||
1013 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_GETDEBUG: Bad copy to user space\n"); | ||
1014 | p->RIOError.Error = COPYOUT_FAILED; | ||
1015 | return -EFAULT; | ||
1016 | } | ||
1017 | } | ||
1018 | return retval; | ||
1001 | 1019 | ||
1002 | case RIO_STOP_POLLER: | 1020 | case RIO_VERSID: |
1003 | rio_dprintk (RIO_DEBUG_CTRL, "RIO_STOP_POLLER\n"); | 1021 | /* |
1004 | if ( !su ) { | 1022 | ** Enquire about the release and version. |
1005 | p->RIOError.Error = NOT_SUPER_USER; | 1023 | ** We return MAX_VERSION_LEN bytes, being a |
1006 | return -EPERM; | 1024 | ** textual null terminated string. |
1007 | } | 1025 | */ |
1008 | p->RIOPolling = NOT_POLLING; | 1026 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_VERSID\n"); |
1009 | return retval; | 1027 | if (copyout((caddr_t) RIOVersid(), (int) arg, sizeof(struct rioVersion)) == COPYFAIL) { |
1010 | 1028 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_VERSID: Bad copy to user space (host=%d)\n", Host); | |
1011 | case RIO_SETDEBUG: | 1029 | p->RIOError.Error = COPYOUT_FAILED; |
1012 | case RIO_GETDEBUG: | 1030 | return -EFAULT; |
1013 | rio_dprintk (RIO_DEBUG_CTRL, "RIO_SETDEBUG/RIO_GETDEBUG\n"); | 1031 | } |
1014 | if ( copyin( (int)arg, (caddr_t)&DebugCtrl, sizeof(DebugCtrl) ) | 1032 | return retval; |
1015 | ==COPYFAIL ) { | ||
1016 | p->RIOError.Error = COPYIN_FAILED; | ||
1017 | return -EFAULT; | ||
1018 | } | ||
1019 | if ( DebugCtrl.SysPort == NO_PORT ) { | ||
1020 | if ( cmd == RIO_SETDEBUG ) { | ||
1021 | if ( !su ) { | ||
1022 | p->RIOError.Error = NOT_SUPER_USER; | ||
1023 | return -EPERM; | ||
1024 | } | ||
1025 | p->rio_debug = DebugCtrl.Debug; | ||
1026 | p->RIODebugWait = DebugCtrl.Wait; | ||
1027 | rio_dprintk (RIO_DEBUG_CTRL, "Set global debug to 0x%x set wait to 0x%x\n", | ||
1028 | p->rio_debug,p->RIODebugWait); | ||
1029 | } | ||
1030 | else { | ||
1031 | rio_dprintk (RIO_DEBUG_CTRL, "Get global debug 0x%x wait 0x%x\n", | ||
1032 | p->rio_debug,p->RIODebugWait); | ||
1033 | DebugCtrl.Debug = p->rio_debug; | ||
1034 | DebugCtrl.Wait = p->RIODebugWait; | ||
1035 | if ( copyout((caddr_t)&DebugCtrl,(int)arg, | ||
1036 | sizeof(DebugCtrl)) == COPYFAIL ) { | ||
1037 | rio_dprintk (RIO_DEBUG_CTRL, "RIO_SET/GET DEBUG: bad port number %d\n", | ||
1038 | DebugCtrl.SysPort); | ||
1039 | p->RIOError.Error = COPYOUT_FAILED; | ||
1040 | return -EFAULT; | ||
1041 | } | ||
1042 | } | ||
1043 | } | ||
1044 | else if ( DebugCtrl.SysPort >= RIO_PORTS && | ||
1045 | DebugCtrl.SysPort != NO_PORT ) { | ||
1046 | rio_dprintk (RIO_DEBUG_CTRL, "RIO_SET/GET DEBUG: bad port number %d\n", | ||
1047 | DebugCtrl.SysPort); | ||
1048 | p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE; | ||
1049 | return -ENXIO; | ||
1050 | } | ||
1051 | else if ( cmd == RIO_SETDEBUG ) { | ||
1052 | if ( !su ) { | ||
1053 | p->RIOError.Error = NOT_SUPER_USER; | ||
1054 | return -EPERM; | ||
1055 | } | ||
1056 | rio_spin_lock_irqsave(&PortP->portSem, flags); | ||
1057 | p->RIOPortp[DebugCtrl.SysPort]->Debug = DebugCtrl.Debug; | ||
1058 | rio_spin_unlock_irqrestore( &PortP->portSem , flags); | ||
1059 | rio_dprintk (RIO_DEBUG_CTRL, "RIO_SETDEBUG 0x%x\n", | ||
1060 | p->RIOPortp[DebugCtrl.SysPort]->Debug); | ||
1061 | } | ||
1062 | else { | ||
1063 | rio_dprintk (RIO_DEBUG_CTRL, "RIO_GETDEBUG 0x%x\n", | ||
1064 | p->RIOPortp[DebugCtrl.SysPort]->Debug); | ||
1065 | DebugCtrl.Debug = p->RIOPortp[DebugCtrl.SysPort]->Debug; | ||
1066 | if ( copyout((caddr_t)&DebugCtrl,(int)arg, | ||
1067 | sizeof(DebugCtrl))==COPYFAIL ) { | ||
1068 | rio_dprintk (RIO_DEBUG_CTRL, "RIO_GETDEBUG: Bad copy to user space\n"); | ||
1069 | p->RIOError.Error = COPYOUT_FAILED; | ||
1070 | return -EFAULT; | ||
1071 | } | ||
1072 | } | ||
1073 | return retval; | ||
1074 | |||
1075 | case RIO_VERSID: | ||
1076 | /* | ||
1077 | ** Enquire about the release and version. | ||
1078 | ** We return MAX_VERSION_LEN bytes, being a | ||
1079 | ** textual null terminated string. | ||
1080 | */ | ||
1081 | rio_dprintk (RIO_DEBUG_CTRL, "RIO_VERSID\n"); | ||
1082 | if ( copyout( (caddr_t)RIOVersid(), | ||
1083 | (int)arg, | ||
1084 | sizeof(struct rioVersion) ) == COPYFAIL ) | ||
1085 | { | ||
1086 | rio_dprintk (RIO_DEBUG_CTRL, "RIO_VERSID: Bad copy to user space (host=%d)\n", Host); | ||
1087 | p->RIOError.Error = COPYOUT_FAILED; | ||
1088 | return -EFAULT; | ||
1089 | } | ||
1090 | return retval; | ||
1091 | 1033 | ||
1092 | /* | 1034 | /* |
1093 | ** !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | 1035 | ** !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
1094 | ** !! commented out previous 'RIO_VERSID' functionality !! | 1036 | ** !! commented out previous 'RIO_VERSID' functionality !! |
1095 | ** !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | 1037 | ** !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
1096 | ** | 1038 | ** |
1097 | case RIO_VERSID: | 1039 | case RIO_VERSID: |
1098 | ** | 1040 | ** |
1099 | ** Enquire about the release and version. | 1041 | ** Enquire about the release and version. |
1100 | ** We return MAX_VERSION_LEN bytes, being a textual null | 1042 | ** We return MAX_VERSION_LEN bytes, being a textual null |
1101 | ** terminated string. | 1043 | ** terminated string. |
1102 | ** | 1044 | ** |
1103 | rio_dprint(RIO_DEBUG_CTRL, ("RIO_VERSID\n")); | 1045 | rio_dprint(RIO_DEBUG_CTRL, ("RIO_VERSID\n")); |
1104 | if (copyout((caddr_t)RIOVersid(), | 1046 | if (copyout((caddr_t)RIOVersid(), |
1105 | (int)arg, MAX_VERSION_LEN ) == COPYFAIL ) { | 1047 | (int)arg, MAX_VERSION_LEN ) == COPYFAIL ) { |
1106 | rio_dprint(RIO_DEBUG_CTRL, ("RIO_VERSID: Bad copy to user space\n",Host)); | 1048 | rio_dprint(RIO_DEBUG_CTRL, ("RIO_VERSID: Bad copy to user space\n",Host)); |
1107 | p->RIOError.Error = COPYOUT_FAILED; | 1049 | p->RIOError.Error = COPYOUT_FAILED; |
1108 | return -EFAULT; | 1050 | return -EFAULT; |
1109 | } | 1051 | } |
1110 | return retval; | 1052 | return retval; |
1111 | ** | 1053 | ** |
1112 | ** !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | 1054 | ** !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
1113 | */ | 1055 | */ |
1114 | 1056 | ||
1115 | case RIO_NUM_HOSTS: | 1057 | case RIO_NUM_HOSTS: |
1116 | /* | 1058 | /* |
1117 | ** Enquire as to the number of hosts located | 1059 | ** Enquire as to the number of hosts located |
1118 | ** at init time. | 1060 | ** at init time. |
1119 | */ | 1061 | */ |
1120 | rio_dprintk (RIO_DEBUG_CTRL, "RIO_NUM_HOSTS\n"); | 1062 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_NUM_HOSTS\n"); |
1121 | if (copyout((caddr_t)&p->RIONumHosts, (int)arg, | 1063 | if (copyout((caddr_t) & p->RIONumHosts, (int) arg, sizeof(p->RIONumHosts)) == COPYFAIL) { |
1122 | sizeof(p->RIONumHosts) )==COPYFAIL ) { | 1064 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_NUM_HOSTS: Bad copy to user space\n"); |
1123 | rio_dprintk (RIO_DEBUG_CTRL, "RIO_NUM_HOSTS: Bad copy to user space\n"); | 1065 | p->RIOError.Error = COPYOUT_FAILED; |
1124 | p->RIOError.Error = COPYOUT_FAILED; | 1066 | return -EFAULT; |
1125 | return -EFAULT; | 1067 | } |
1126 | } | 1068 | return retval; |
1127 | return retval; | 1069 | |
1128 | 1070 | case RIO_HOST_FOAD: | |
1129 | case RIO_HOST_FOAD: | 1071 | /* |
1130 | /* | 1072 | ** Kill host. This may not be in the final version... |
1131 | ** Kill host. This may not be in the final version... | 1073 | */ |
1132 | */ | 1074 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_FOAD %d\n", (int) arg); |
1133 | rio_dprintk (RIO_DEBUG_CTRL, "RIO_HOST_FOAD %d\n", (int)arg); | 1075 | if (!su) { |
1134 | if ( !su ) { | 1076 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_FOAD: Not super user\n"); |
1135 | rio_dprintk (RIO_DEBUG_CTRL, "RIO_HOST_FOAD: Not super user\n"); | 1077 | p->RIOError.Error = NOT_SUPER_USER; |
1136 | p->RIOError.Error = NOT_SUPER_USER; | 1078 | return -EPERM; |
1137 | return -EPERM; | 1079 | } |
1138 | } | 1080 | p->RIOHalted = 1; |
1139 | p->RIOHalted = 1; | 1081 | p->RIOSystemUp = 0; |
1140 | p->RIOSystemUp = 0; | 1082 | |
1141 | 1083 | for (Host = 0; Host < p->RIONumHosts; Host++) { | |
1142 | for ( Host=0; Host<p->RIONumHosts; Host++ ) { | 1084 | (void) RIOBoardTest(p->RIOHosts[Host].PaddrP, p->RIOHosts[Host].Caddr, p->RIOHosts[Host].Type, p->RIOHosts[Host].Slot); |
1143 | (void)RIOBoardTest( p->RIOHosts[Host].PaddrP, | 1085 | bzero((caddr_t) & p->RIOHosts[Host].Flags, ((int) &p->RIOHosts[Host].____end_marker____) - ((int) &p->RIOHosts[Host].Flags)); |
1144 | p->RIOHosts[Host].Caddr, p->RIOHosts[Host].Type, | 1086 | p->RIOHosts[Host].Flags = RC_WAITING; |
1145 | p->RIOHosts[Host].Slot ); | ||
1146 | bzero( (caddr_t)&p->RIOHosts[Host].Flags, | ||
1147 | ((int)&p->RIOHosts[Host].____end_marker____) - | ||
1148 | ((int)&p->RIOHosts[Host].Flags) ); | ||
1149 | p->RIOHosts[Host].Flags = RC_WAITING; | ||
1150 | #if 0 | 1087 | #if 0 |
1151 | RIOSetupDataStructs(p); | 1088 | RIOSetupDataStructs(p); |
1152 | #endif | 1089 | #endif |
1153 | } | 1090 | } |
1154 | RIOFoadWakeup(p); | 1091 | RIOFoadWakeup(p); |
1155 | p->RIONumBootPkts = 0; | 1092 | p->RIONumBootPkts = 0; |
1156 | p->RIOBooting = 0; | 1093 | p->RIOBooting = 0; |
1157 | 1094 | ||
1158 | #ifdef RINGBUFFER_SUPPORT | 1095 | #ifdef RINGBUFFER_SUPPORT |
1159 | for( loop=0; loop<RIO_PORTS; loop++ ) | 1096 | for (loop = 0; loop < RIO_PORTS; loop++) |
1160 | if ( p->RIOPortp[loop]->TxRingBuffer ) | 1097 | if (p->RIOPortp[loop]->TxRingBuffer) |
1161 | sysfree((void *)p->RIOPortp[loop]->TxRingBuffer, | 1098 | sysfree((void *) p->RIOPortp[loop]->TxRingBuffer, RIOBufferSize); |
1162 | RIOBufferSize ); | ||
1163 | #endif | 1099 | #endif |
1164 | #if 0 | 1100 | #if 0 |
1165 | bzero((caddr_t)&p->RIOPortp[0],RIO_PORTS*sizeof(struct Port)); | 1101 | bzero((caddr_t) & p->RIOPortp[0], RIO_PORTS * sizeof(struct Port)); |
1166 | #else | 1102 | #else |
1167 | printk ("HEEEEELP!\n"); | 1103 | printk("HEEEEELP!\n"); |
1168 | #endif | 1104 | #endif |
1169 | 1105 | ||
1170 | for( loop=0; loop<RIO_PORTS; loop++ ) { | 1106 | for (loop = 0; loop < RIO_PORTS; loop++) { |
1171 | #if 0 | 1107 | #if 0 |
1172 | p->RIOPortp[loop]->TtyP = &p->channel[loop]; | 1108 | p->RIOPortp[loop]->TtyP = &p->channel[loop]; |
1173 | #endif | 1109 | #endif |
1174 | |||
1175 | spin_lock_init(&p->RIOPortp[loop]->portSem); | ||
1176 | p->RIOPortp[loop]->InUse = NOT_INUSE; | ||
1177 | } | ||
1178 | |||
1179 | p->RIOSystemUp = 0; | ||
1180 | return retval; | ||
1181 | |||
1182 | case RIO_DOWNLOAD: | ||
1183 | rio_dprintk (RIO_DEBUG_CTRL, "RIO_DOWNLOAD\n"); | ||
1184 | if ( !su ) { | ||
1185 | rio_dprintk (RIO_DEBUG_CTRL, "RIO_DOWNLOAD: Not super user\n"); | ||
1186 | p->RIOError.Error = NOT_SUPER_USER; | ||
1187 | return -EPERM; | ||
1188 | } | ||
1189 | if ( copyin((int)arg, (caddr_t)&DownLoad, | ||
1190 | sizeof(DownLoad) )==COPYFAIL ) { | ||
1191 | rio_dprintk (RIO_DEBUG_CTRL, "RIO_DOWNLOAD: Copy in from user space failed\n"); | ||
1192 | p->RIOError.Error = COPYIN_FAILED; | ||
1193 | return -EFAULT; | ||
1194 | } | ||
1195 | rio_dprintk (RIO_DEBUG_CTRL, "Copied in download code for product code 0x%x\n", | ||
1196 | DownLoad.ProductCode); | ||
1197 | |||
1198 | /* | ||
1199 | ** It is important that the product code is an unsigned object! | ||
1200 | */ | ||
1201 | if ( DownLoad.ProductCode > MAX_PRODUCT ) { | ||
1202 | rio_dprintk (RIO_DEBUG_CTRL, "RIO_DOWNLOAD: Bad product code %d passed\n", | ||
1203 | DownLoad.ProductCode); | ||
1204 | p->RIOError.Error = NO_SUCH_PRODUCT; | ||
1205 | return -ENXIO; | ||
1206 | } | ||
1207 | /* | ||
1208 | ** do something! | ||
1209 | */ | ||
1210 | retval = (*(RIOBootTable[DownLoad.ProductCode]))(p, &DownLoad); | ||
1211 | /* <-- Panic */ | ||
1212 | p->RIOHalted = 0; | ||
1213 | /* | ||
1214 | ** and go back, content with a job well completed. | ||
1215 | */ | ||
1216 | return retval; | ||
1217 | |||
1218 | case RIO_PARMS: | ||
1219 | { | ||
1220 | uint host; | ||
1221 | |||
1222 | if (copyin((int)arg, (caddr_t)&host, | ||
1223 | sizeof(host) ) == COPYFAIL ) { | ||
1224 | rio_dprintk (RIO_DEBUG_CTRL, | ||
1225 | "RIO_HOST_REQ: Copy in from user space failed\n"); | ||
1226 | p->RIOError.Error = COPYIN_FAILED; | ||
1227 | return -EFAULT; | ||
1228 | } | ||
1229 | /* | ||
1230 | ** Fetch the parmmap | ||
1231 | */ | ||
1232 | rio_dprintk (RIO_DEBUG_CTRL, "RIO_PARMS\n"); | ||
1233 | if ( copyout( (caddr_t)p->RIOHosts[host].ParmMapP, | ||
1234 | (int)arg, sizeof(PARM_MAP) )==COPYFAIL ) { | ||
1235 | p->RIOError.Error = COPYOUT_FAILED; | ||
1236 | rio_dprintk (RIO_DEBUG_CTRL, "RIO_PARMS: Copy out to user space failed\n"); | ||
1237 | return -EFAULT; | ||
1238 | } | ||
1239 | } | ||
1240 | return retval; | ||
1241 | |||
1242 | case RIO_HOST_REQ: | ||
1243 | rio_dprintk (RIO_DEBUG_CTRL, "RIO_HOST_REQ\n"); | ||
1244 | if (copyin((int)arg, (caddr_t)&HostReq, | ||
1245 | sizeof(HostReq) )==COPYFAIL ) { | ||
1246 | rio_dprintk (RIO_DEBUG_CTRL, "RIO_HOST_REQ: Copy in from user space failed\n"); | ||
1247 | p->RIOError.Error = COPYIN_FAILED; | ||
1248 | return -EFAULT; | ||
1249 | } | ||
1250 | if ( HostReq.HostNum >= p->RIONumHosts ) { | ||
1251 | p->RIOError.Error = HOST_NUMBER_OUT_OF_RANGE; | ||
1252 | rio_dprintk (RIO_DEBUG_CTRL, "RIO_HOST_REQ: Illegal host number %d\n", | ||
1253 | HostReq.HostNum); | ||
1254 | return -ENXIO; | ||
1255 | } | ||
1256 | rio_dprintk (RIO_DEBUG_CTRL, "Request for host %d\n", HostReq.HostNum); | ||
1257 | 1110 | ||
1258 | if (copyout((caddr_t)&p->RIOHosts[HostReq.HostNum], | 1111 | spin_lock_init(&p->RIOPortp[loop]->portSem); |
1259 | (int)HostReq.HostP,sizeof(struct Host) ) == COPYFAIL) { | 1112 | p->RIOPortp[loop]->InUse = NOT_INUSE; |
1260 | p->RIOError.Error = COPYOUT_FAILED; | 1113 | } |
1261 | rio_dprintk (RIO_DEBUG_CTRL, "RIO_HOST_REQ: Bad copy to user space\n"); | 1114 | |
1262 | return -EFAULT; | 1115 | p->RIOSystemUp = 0; |
1263 | } | 1116 | return retval; |
1264 | return retval; | 1117 | |
1265 | 1118 | case RIO_DOWNLOAD: | |
1266 | case RIO_HOST_DPRAM: | 1119 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_DOWNLOAD\n"); |
1267 | rio_dprintk (RIO_DEBUG_CTRL, "Request for DPRAM\n"); | 1120 | if (!su) { |
1268 | if ( copyin( (int)arg, (caddr_t)&HostDpRam, | 1121 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_DOWNLOAD: Not super user\n"); |
1269 | sizeof(HostDpRam) )==COPYFAIL ) { | 1122 | p->RIOError.Error = NOT_SUPER_USER; |
1270 | rio_dprintk (RIO_DEBUG_CTRL, "RIO_HOST_DPRAM: Copy in from user space failed\n"); | 1123 | return -EPERM; |
1271 | p->RIOError.Error = COPYIN_FAILED; | 1124 | } |
1272 | return -EFAULT; | 1125 | if (copyin((int) arg, (caddr_t) & DownLoad, sizeof(DownLoad)) == COPYFAIL) { |
1273 | } | 1126 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_DOWNLOAD: Copy in from user space failed\n"); |
1274 | if ( HostDpRam.HostNum >= p->RIONumHosts ) { | 1127 | p->RIOError.Error = COPYIN_FAILED; |
1275 | p->RIOError.Error = HOST_NUMBER_OUT_OF_RANGE; | 1128 | return -EFAULT; |
1276 | rio_dprintk (RIO_DEBUG_CTRL, "RIO_HOST_DPRAM: Illegal host number %d\n", | 1129 | } |
1277 | HostDpRam.HostNum); | 1130 | rio_dprintk(RIO_DEBUG_CTRL, "Copied in download code for product code 0x%x\n", DownLoad.ProductCode); |
1278 | return -ENXIO; | ||
1279 | } | ||
1280 | rio_dprintk (RIO_DEBUG_CTRL, "Request for host %d\n", HostDpRam.HostNum); | ||
1281 | |||
1282 | if (p->RIOHosts[HostDpRam.HostNum].Type == RIO_PCI) { | ||
1283 | int off; | ||
1284 | /* It's hardware like this that really gets on my tits. */ | ||
1285 | static unsigned char copy[sizeof(struct DpRam)]; | ||
1286 | for ( off=0; off<sizeof(struct DpRam); off++ ) | ||
1287 | copy[off] = p->RIOHosts[HostDpRam.HostNum].Caddr[off]; | ||
1288 | if ( copyout( (caddr_t)copy, (int)HostDpRam.DpRamP, | ||
1289 | sizeof(struct DpRam) ) == COPYFAIL ) { | ||
1290 | p->RIOError.Error = COPYOUT_FAILED; | ||
1291 | rio_dprintk (RIO_DEBUG_CTRL, "RIO_HOST_DPRAM: Bad copy to user space\n"); | ||
1292 | return -EFAULT; | ||
1293 | } | ||
1294 | } | ||
1295 | else if (copyout((caddr_t)p->RIOHosts[HostDpRam.HostNum].Caddr, | ||
1296 | (int)HostDpRam.DpRamP, | ||
1297 | sizeof(struct DpRam) ) == COPYFAIL ) { | ||
1298 | p->RIOError.Error = COPYOUT_FAILED; | ||
1299 | rio_dprintk (RIO_DEBUG_CTRL, "RIO_HOST_DPRAM: Bad copy to user space\n"); | ||
1300 | return -EFAULT; | ||
1301 | } | ||
1302 | return retval; | ||
1303 | |||
1304 | case RIO_SET_BUSY: | ||
1305 | rio_dprintk (RIO_DEBUG_CTRL, "RIO_SET_BUSY\n"); | ||
1306 | if ( (int)arg < 0 || (int)arg > 511 ) { | ||
1307 | rio_dprintk (RIO_DEBUG_CTRL, "RIO_SET_BUSY: Bad port number %d\n",(int)arg); | ||
1308 | p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE; | ||
1309 | return -EINVAL; | ||
1310 | } | ||
1311 | rio_spin_lock_irqsave(&PortP->portSem, flags); | ||
1312 | p->RIOPortp[(int)arg]->State |= RIO_BUSY; | ||
1313 | rio_spin_unlock_irqrestore( &PortP->portSem , flags); | ||
1314 | return retval; | ||
1315 | |||
1316 | case RIO_HOST_PORT: | ||
1317 | /* | ||
1318 | ** The daemon want port information | ||
1319 | ** (probably for debug reasons) | ||
1320 | */ | ||
1321 | rio_dprintk (RIO_DEBUG_CTRL, "RIO_HOST_PORT\n"); | ||
1322 | if ( copyin((int)arg, (caddr_t)&PortReq, | ||
1323 | sizeof(PortReq) )==COPYFAIL ) { | ||
1324 | rio_dprintk (RIO_DEBUG_CTRL, "RIO_HOST_PORT: Copy in from user space failed\n"); | ||
1325 | p->RIOError.Error = COPYIN_FAILED; | ||
1326 | return -EFAULT; | ||
1327 | } | ||
1328 | |||
1329 | if (PortReq.SysPort >= RIO_PORTS) { /* SysPort is unsigned */ | ||
1330 | rio_dprintk (RIO_DEBUG_CTRL, "RIO_HOST_PORT: Illegal port number %d\n", | ||
1331 | PortReq.SysPort); | ||
1332 | p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE; | ||
1333 | return -ENXIO; | ||
1334 | } | ||
1335 | rio_dprintk (RIO_DEBUG_CTRL, "Request for port %d\n", PortReq.SysPort); | ||
1336 | if (copyout((caddr_t)p->RIOPortp[PortReq.SysPort], | ||
1337 | (int)PortReq.PortP, | ||
1338 | sizeof(struct Port) ) == COPYFAIL) { | ||
1339 | p->RIOError.Error = COPYOUT_FAILED; | ||
1340 | rio_dprintk (RIO_DEBUG_CTRL, "RIO_HOST_PORT: Bad copy to user space\n"); | ||
1341 | return -EFAULT; | ||
1342 | } | ||
1343 | return retval; | ||
1344 | |||
1345 | case RIO_HOST_RUP: | ||
1346 | /* | ||
1347 | ** The daemon want rup information | ||
1348 | ** (probably for debug reasons) | ||
1349 | */ | ||
1350 | rio_dprintk (RIO_DEBUG_CTRL, "RIO_HOST_RUP\n"); | ||
1351 | if (copyin((int)arg, (caddr_t)&RupReq, | ||
1352 | sizeof(RupReq) )==COPYFAIL ) { | ||
1353 | rio_dprintk (RIO_DEBUG_CTRL, "RIO_HOST_RUP: Copy in from user space failed\n"); | ||
1354 | p->RIOError.Error = COPYIN_FAILED; | ||
1355 | return -EFAULT; | ||
1356 | } | ||
1357 | if (RupReq.HostNum >= p->RIONumHosts) { /* host is unsigned */ | ||
1358 | rio_dprintk (RIO_DEBUG_CTRL, "RIO_HOST_RUP: Illegal host number %d\n", | ||
1359 | RupReq.HostNum); | ||
1360 | p->RIOError.Error = HOST_NUMBER_OUT_OF_RANGE; | ||
1361 | return -ENXIO; | ||
1362 | } | ||
1363 | if ( RupReq.RupNum >= MAX_RUP+LINKS_PER_UNIT ) { /* eek! */ | ||
1364 | rio_dprintk (RIO_DEBUG_CTRL, "RIO_HOST_RUP: Illegal rup number %d\n", | ||
1365 | RupReq.RupNum); | ||
1366 | p->RIOError.Error = RUP_NUMBER_OUT_OF_RANGE; | ||
1367 | return -EINVAL; | ||
1368 | } | ||
1369 | HostP = &p->RIOHosts[RupReq.HostNum]; | ||
1370 | |||
1371 | if ((HostP->Flags & RUN_STATE) != RC_RUNNING) { | ||
1372 | rio_dprintk (RIO_DEBUG_CTRL, "RIO_HOST_RUP: Host %d not running\n", | ||
1373 | RupReq.HostNum); | ||
1374 | p->RIOError.Error = HOST_NOT_RUNNING; | ||
1375 | return -EIO; | ||
1376 | } | ||
1377 | rio_dprintk (RIO_DEBUG_CTRL, "Request for rup %d from host %d\n", | ||
1378 | RupReq.RupNum,RupReq.HostNum); | ||
1379 | |||
1380 | if (copyout((caddr_t)HostP->UnixRups[RupReq.RupNum].RupP, | ||
1381 | (int)RupReq.RupP,sizeof(struct RUP) ) == COPYFAIL) { | ||
1382 | p->RIOError.Error = COPYOUT_FAILED; | ||
1383 | rio_dprintk (RIO_DEBUG_CTRL, "RIO_HOST_RUP: Bad copy to user space\n"); | ||
1384 | return -EFAULT; | ||
1385 | } | ||
1386 | return retval; | ||
1387 | |||
1388 | case RIO_HOST_LPB: | ||
1389 | /* | ||
1390 | ** The daemon want lpb information | ||
1391 | ** (probably for debug reasons) | ||
1392 | */ | ||
1393 | rio_dprintk (RIO_DEBUG_CTRL, "RIO_HOST_LPB\n"); | ||
1394 | if (copyin((int)arg, (caddr_t)&LpbReq, | ||
1395 | sizeof(LpbReq) )==COPYFAIL ) { | ||
1396 | rio_dprintk (RIO_DEBUG_CTRL, "RIO_HOST_LPB: Bad copy from user space\n"); | ||
1397 | p->RIOError.Error = COPYIN_FAILED; | ||
1398 | return -EFAULT; | ||
1399 | } | ||
1400 | if (LpbReq.Host >= p->RIONumHosts) { /* host is unsigned */ | ||
1401 | rio_dprintk (RIO_DEBUG_CTRL, "RIO_HOST_LPB: Illegal host number %d\n", | ||
1402 | LpbReq.Host); | ||
1403 | p->RIOError.Error = HOST_NUMBER_OUT_OF_RANGE; | ||
1404 | return -ENXIO; | ||
1405 | } | ||
1406 | if ( LpbReq.Link >= LINKS_PER_UNIT ) { /* eek! */ | ||
1407 | rio_dprintk (RIO_DEBUG_CTRL, "RIO_HOST_LPB: Illegal link number %d\n", | ||
1408 | LpbReq.Link); | ||
1409 | p->RIOError.Error = LINK_NUMBER_OUT_OF_RANGE; | ||
1410 | return -EINVAL; | ||
1411 | } | ||
1412 | HostP = &p->RIOHosts[LpbReq.Host]; | ||
1413 | |||
1414 | if ( (HostP->Flags & RUN_STATE) != RC_RUNNING ) { | ||
1415 | rio_dprintk (RIO_DEBUG_CTRL, "RIO_HOST_LPB: Host %d not running\n", | ||
1416 | LpbReq.Host ); | ||
1417 | p->RIOError.Error = HOST_NOT_RUNNING; | ||
1418 | return -EIO; | ||
1419 | } | ||
1420 | rio_dprintk (RIO_DEBUG_CTRL, "Request for lpb %d from host %d\n", | ||
1421 | LpbReq.Link, LpbReq.Host); | ||
1422 | |||
1423 | if (copyout((caddr_t)&HostP->LinkStrP[LpbReq.Link], | ||
1424 | (int)LpbReq.LpbP,sizeof(struct LPB) ) == COPYFAIL) { | ||
1425 | rio_dprintk (RIO_DEBUG_CTRL, "RIO_HOST_LPB: Bad copy to user space\n"); | ||
1426 | p->RIOError.Error = COPYOUT_FAILED; | ||
1427 | return -EFAULT; | ||
1428 | } | ||
1429 | return retval; | ||
1430 | |||
1431 | /* | ||
1432 | ** Here 3 IOCTL's that allow us to change the way in which | ||
1433 | ** rio logs errors. send them just to syslog or send them | ||
1434 | ** to both syslog and console or send them to just the console. | ||
1435 | ** | ||
1436 | ** See RioStrBuf() in util.c for the other half. | ||
1437 | */ | ||
1438 | case RIO_SYSLOG_ONLY: | ||
1439 | p->RIOPrintLogState = PRINT_TO_LOG; /* Just syslog */ | ||
1440 | return 0; | ||
1441 | |||
1442 | case RIO_SYSLOG_CONS: | ||
1443 | p->RIOPrintLogState = PRINT_TO_LOG_CONS;/* syslog and console */ | ||
1444 | return 0; | ||
1445 | |||
1446 | case RIO_CONS_ONLY: | ||
1447 | p->RIOPrintLogState = PRINT_TO_CONS; /* Just console */ | ||
1448 | return 0; | ||
1449 | |||
1450 | case RIO_SIGNALS_ON: | ||
1451 | if ( p->RIOSignalProcess ) { | ||
1452 | p->RIOError.Error = SIGNALS_ALREADY_SET; | ||
1453 | return -EBUSY; | ||
1454 | } | ||
1455 | p->RIOSignalProcess = getpid(); | ||
1456 | p->RIOPrintDisabled = DONT_PRINT; | ||
1457 | return retval; | ||
1458 | |||
1459 | case RIO_SIGNALS_OFF: | ||
1460 | if ( p->RIOSignalProcess != getpid() ) { | ||
1461 | p->RIOError.Error = NOT_RECEIVING_PROCESS; | ||
1462 | return -EPERM; | ||
1463 | } | ||
1464 | rio_dprintk (RIO_DEBUG_CTRL, "Clear signal process to zero\n"); | ||
1465 | p->RIOSignalProcess = 0; | ||
1466 | return retval; | ||
1467 | |||
1468 | case RIO_SET_BYTE_MODE: | ||
1469 | for ( Host=0; Host<p->RIONumHosts; Host++ ) | ||
1470 | if ( p->RIOHosts[Host].Type == RIO_AT ) | ||
1471 | p->RIOHosts[Host].Mode &= ~WORD_OPERATION; | ||
1472 | return retval; | ||
1473 | |||
1474 | case RIO_SET_WORD_MODE: | ||
1475 | for ( Host=0; Host<p->RIONumHosts; Host++ ) | ||
1476 | if ( p->RIOHosts[Host].Type == RIO_AT ) | ||
1477 | p->RIOHosts[Host].Mode |= WORD_OPERATION; | ||
1478 | return retval; | ||
1479 | |||
1480 | case RIO_SET_FAST_BUS: | ||
1481 | for ( Host=0; Host<p->RIONumHosts; Host++ ) | ||
1482 | if ( p->RIOHosts[Host].Type == RIO_AT ) | ||
1483 | p->RIOHosts[Host].Mode |= FAST_AT_BUS; | ||
1484 | return retval; | ||
1485 | |||
1486 | case RIO_SET_SLOW_BUS: | ||
1487 | for ( Host=0; Host<p->RIONumHosts; Host++ ) | ||
1488 | if ( p->RIOHosts[Host].Type == RIO_AT ) | ||
1489 | p->RIOHosts[Host].Mode &= ~FAST_AT_BUS; | ||
1490 | return retval; | ||
1491 | |||
1492 | case RIO_MAP_B50_TO_50: | ||
1493 | case RIO_MAP_B50_TO_57600: | ||
1494 | case RIO_MAP_B110_TO_110: | ||
1495 | case RIO_MAP_B110_TO_115200: | ||
1496 | rio_dprintk (RIO_DEBUG_CTRL, "Baud rate mapping\n"); | ||
1497 | port = (uint) arg; | ||
1498 | if ( port < 0 || port > 511 ) { | ||
1499 | rio_dprintk (RIO_DEBUG_CTRL, "Baud rate mapping: Bad port number %d\n", port); | ||
1500 | p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE; | ||
1501 | return -EINVAL; | ||
1502 | } | ||
1503 | rio_spin_lock_irqsave(&PortP->portSem, flags); | ||
1504 | switch( cmd ) | ||
1505 | { | ||
1506 | case RIO_MAP_B50_TO_50 : | ||
1507 | p->RIOPortp[port]->Config |= RIO_MAP_50_TO_50; | ||
1508 | break; | ||
1509 | case RIO_MAP_B50_TO_57600 : | ||
1510 | p->RIOPortp[port]->Config &= ~RIO_MAP_50_TO_50; | ||
1511 | break; | ||
1512 | case RIO_MAP_B110_TO_110 : | ||
1513 | p->RIOPortp[port]->Config |= RIO_MAP_110_TO_110; | ||
1514 | break; | ||
1515 | case RIO_MAP_B110_TO_115200 : | ||
1516 | p->RIOPortp[port]->Config &= ~RIO_MAP_110_TO_110; | ||
1517 | break; | ||
1518 | } | ||
1519 | rio_spin_unlock_irqrestore( &PortP->portSem , flags); | ||
1520 | return retval; | ||
1521 | |||
1522 | case RIO_STREAM_INFO: | ||
1523 | rio_dprintk (RIO_DEBUG_CTRL, "RIO_STREAM_INFO\n"); | ||
1524 | return -EINVAL; | ||
1525 | 1131 | ||
1526 | case RIO_SEND_PACKET: | 1132 | /* |
1527 | rio_dprintk (RIO_DEBUG_CTRL, "RIO_SEND_PACKET\n"); | 1133 | ** It is important that the product code is an unsigned object! |
1528 | if ( copyin( (int)arg, (caddr_t)&SendPack, | 1134 | */ |
1529 | sizeof(SendPack) )==COPYFAIL ) { | 1135 | if (DownLoad.ProductCode > MAX_PRODUCT) { |
1530 | rio_dprintk (RIO_DEBUG_CTRL, "RIO_SEND_PACKET: Bad copy from user space\n"); | 1136 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_DOWNLOAD: Bad product code %d passed\n", DownLoad.ProductCode); |
1531 | p->RIOError.Error = COPYIN_FAILED; | 1137 | p->RIOError.Error = NO_SUCH_PRODUCT; |
1532 | return -EFAULT; | 1138 | return -ENXIO; |
1533 | } | 1139 | } |
1534 | if ( SendPack.PortNum >= 128 ) { | 1140 | /* |
1535 | p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE; | 1141 | ** do something! |
1536 | return -ENXIO; | 1142 | */ |
1537 | } | 1143 | retval = (*(RIOBootTable[DownLoad.ProductCode])) (p, &DownLoad); |
1538 | 1144 | /* <-- Panic */ | |
1539 | PortP = p->RIOPortp[SendPack.PortNum]; | 1145 | p->RIOHalted = 0; |
1540 | rio_spin_lock_irqsave(&PortP->portSem, flags); | 1146 | /* |
1541 | 1147 | ** and go back, content with a job well completed. | |
1542 | if ( !can_add_transmit(&PacketP,PortP) ) { | 1148 | */ |
1543 | p->RIOError.Error = UNIT_IS_IN_USE; | 1149 | return retval; |
1544 | rio_spin_unlock_irqrestore( &PortP->portSem , flags); | 1150 | |
1545 | return -ENOSPC; | 1151 | case RIO_PARMS: |
1546 | } | 1152 | { |
1547 | 1153 | uint host; | |
1548 | for ( loop=0; loop<(ushort)(SendPack.Len & 127); loop++ ) | 1154 | |
1549 | WBYTE(PacketP->data[loop], SendPack.Data[loop] ); | 1155 | if (copyin((int) arg, (caddr_t) & host, sizeof(host)) == COPYFAIL) { |
1550 | 1156 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_REQ: Copy in from user space failed\n"); | |
1551 | WBYTE(PacketP->len, SendPack.Len); | 1157 | p->RIOError.Error = COPYIN_FAILED; |
1552 | 1158 | return -EFAULT; | |
1553 | add_transmit( PortP ); | 1159 | } |
1554 | /* | 1160 | /* |
1555 | ** Count characters transmitted for port statistics reporting | 1161 | ** Fetch the parmmap |
1556 | */ | 1162 | */ |
1557 | if (PortP->statsGather) | 1163 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_PARMS\n"); |
1558 | PortP->txchars += (SendPack.Len & 127); | 1164 | if (copyout((caddr_t) p->RIOHosts[host].ParmMapP, (int) arg, sizeof(PARM_MAP)) == COPYFAIL) { |
1559 | rio_spin_unlock_irqrestore( &PortP->portSem , flags); | 1165 | p->RIOError.Error = COPYOUT_FAILED; |
1560 | return retval; | 1166 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_PARMS: Copy out to user space failed\n"); |
1561 | 1167 | return -EFAULT; | |
1562 | case RIO_NO_MESG: | 1168 | } |
1563 | if ( su ) | 1169 | } |
1564 | p->RIONoMessage = 1; | 1170 | return retval; |
1565 | return su ? 0 : -EPERM; | 1171 | |
1566 | 1172 | case RIO_HOST_REQ: | |
1567 | case RIO_MESG: | 1173 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_REQ\n"); |
1568 | if ( su ) | 1174 | if (copyin((int) arg, (caddr_t) & HostReq, sizeof(HostReq)) == COPYFAIL) { |
1569 | p->RIONoMessage = 0; | 1175 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_REQ: Copy in from user space failed\n"); |
1570 | return su ? 0 : -EPERM; | 1176 | p->RIOError.Error = COPYIN_FAILED; |
1571 | 1177 | return -EFAULT; | |
1572 | case RIO_WHAT_MESG: | 1178 | } |
1573 | if ( copyout( (caddr_t)&p->RIONoMessage, (int)arg, | 1179 | if (HostReq.HostNum >= p->RIONumHosts) { |
1574 | sizeof(p->RIONoMessage) )==COPYFAIL ) { | 1180 | p->RIOError.Error = HOST_NUMBER_OUT_OF_RANGE; |
1575 | rio_dprintk (RIO_DEBUG_CTRL, "RIO_WHAT_MESG: Bad copy to user space\n"); | 1181 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_REQ: Illegal host number %d\n", HostReq.HostNum); |
1576 | p->RIOError.Error = COPYOUT_FAILED; | 1182 | return -ENXIO; |
1577 | return -EFAULT; | 1183 | } |
1578 | } | 1184 | rio_dprintk(RIO_DEBUG_CTRL, "Request for host %d\n", HostReq.HostNum); |
1579 | return 0; | 1185 | |
1580 | 1186 | if (copyout((caddr_t) & p->RIOHosts[HostReq.HostNum], (int) HostReq.HostP, sizeof(struct Host)) == COPYFAIL) { | |
1581 | case RIO_MEM_DUMP : | 1187 | p->RIOError.Error = COPYOUT_FAILED; |
1582 | if (copyin((int)arg, (caddr_t)&SubCmd, | 1188 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_REQ: Bad copy to user space\n"); |
1583 | sizeof(struct SubCmdStruct)) == COPYFAIL) { | 1189 | return -EFAULT; |
1584 | p->RIOError.Error = COPYIN_FAILED; | 1190 | } |
1585 | return -EFAULT; | 1191 | return retval; |
1586 | } | 1192 | |
1587 | rio_dprintk (RIO_DEBUG_CTRL, "RIO_MEM_DUMP host %d rup %d addr %x\n", | 1193 | case RIO_HOST_DPRAM: |
1588 | SubCmd.Host, SubCmd.Rup, SubCmd.Addr); | 1194 | rio_dprintk(RIO_DEBUG_CTRL, "Request for DPRAM\n"); |
1589 | 1195 | if (copyin((int) arg, (caddr_t) & HostDpRam, sizeof(HostDpRam)) == COPYFAIL) { | |
1590 | if (SubCmd.Rup >= MAX_RUP+LINKS_PER_UNIT ) { | 1196 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_DPRAM: Copy in from user space failed\n"); |
1591 | p->RIOError.Error = RUP_NUMBER_OUT_OF_RANGE; | 1197 | p->RIOError.Error = COPYIN_FAILED; |
1592 | return -EINVAL; | 1198 | return -EFAULT; |
1593 | } | 1199 | } |
1594 | 1200 | if (HostDpRam.HostNum >= p->RIONumHosts) { | |
1595 | if (SubCmd.Host >= p->RIONumHosts ) { | 1201 | p->RIOError.Error = HOST_NUMBER_OUT_OF_RANGE; |
1596 | p->RIOError.Error = HOST_NUMBER_OUT_OF_RANGE; | 1202 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_DPRAM: Illegal host number %d\n", HostDpRam.HostNum); |
1597 | return -EINVAL; | 1203 | return -ENXIO; |
1598 | } | 1204 | } |
1599 | 1205 | rio_dprintk(RIO_DEBUG_CTRL, "Request for host %d\n", HostDpRam.HostNum); | |
1600 | port = p->RIOHosts[SubCmd.Host]. | 1206 | |
1601 | UnixRups[SubCmd.Rup].BaseSysPort; | 1207 | if (p->RIOHosts[HostDpRam.HostNum].Type == RIO_PCI) { |
1602 | 1208 | int off; | |
1603 | PortP = p->RIOPortp[port]; | 1209 | /* It's hardware like this that really gets on my tits. */ |
1604 | 1210 | static unsigned char copy[sizeof(struct DpRam)]; | |
1605 | rio_spin_lock_irqsave(&PortP->portSem, flags); | 1211 | for (off = 0; off < sizeof(struct DpRam); off++) |
1606 | 1212 | copy[off] = p->RIOHosts[HostDpRam.HostNum].Caddr[off]; | |
1607 | if ( RIOPreemptiveCmd(p, PortP, MEMDUMP ) == RIO_FAIL ) { | 1213 | if (copyout((caddr_t) copy, (int) HostDpRam.DpRamP, sizeof(struct DpRam)) == COPYFAIL) { |
1608 | rio_dprintk (RIO_DEBUG_CTRL, "RIO_MEM_DUMP failed\n"); | 1214 | p->RIOError.Error = COPYOUT_FAILED; |
1609 | rio_spin_unlock_irqrestore( &PortP->portSem , flags); | 1215 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_DPRAM: Bad copy to user space\n"); |
1610 | return -EBUSY; | 1216 | return -EFAULT; |
1611 | } | 1217 | } |
1612 | else | 1218 | } else if (copyout((caddr_t) p->RIOHosts[HostDpRam.HostNum].Caddr, (int) HostDpRam.DpRamP, sizeof(struct DpRam)) == COPYFAIL) { |
1613 | PortP->State |= RIO_BUSY; | 1219 | p->RIOError.Error = COPYOUT_FAILED; |
1614 | 1220 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_DPRAM: Bad copy to user space\n"); | |
1615 | rio_spin_unlock_irqrestore( &PortP->portSem , flags); | 1221 | return -EFAULT; |
1616 | if ( copyout( (caddr_t)p->RIOMemDump, (int)arg, | 1222 | } |
1617 | MEMDUMP_SIZE) == COPYFAIL ) { | 1223 | return retval; |
1618 | rio_dprintk (RIO_DEBUG_CTRL, "RIO_MEM_DUMP copy failed\n"); | 1224 | |
1619 | p->RIOError.Error = COPYOUT_FAILED; | 1225 | case RIO_SET_BUSY: |
1620 | return -EFAULT; | 1226 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_SET_BUSY\n"); |
1621 | } | 1227 | if ((int) arg < 0 || (int) arg > 511) { |
1622 | return 0; | 1228 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_SET_BUSY: Bad port number %d\n", (int) arg); |
1623 | 1229 | p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE; | |
1624 | case RIO_TICK: | 1230 | return -EINVAL; |
1625 | if ((int)arg < 0 || (int)arg >= p->RIONumHosts) | 1231 | } |
1626 | return -EINVAL; | 1232 | rio_spin_lock_irqsave(&PortP->portSem, flags); |
1627 | rio_dprintk (RIO_DEBUG_CTRL, "Set interrupt for host %d\n", (int)arg); | 1233 | p->RIOPortp[(int) arg]->State |= RIO_BUSY; |
1628 | WBYTE(p->RIOHosts[(int)arg].SetInt , 0xff); | 1234 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); |
1629 | return 0; | 1235 | return retval; |
1630 | 1236 | ||
1631 | case RIO_TOCK: | 1237 | case RIO_HOST_PORT: |
1632 | if ((int)arg < 0 || (int)arg >= p->RIONumHosts) | 1238 | /* |
1633 | return -EINVAL; | 1239 | ** The daemon want port information |
1634 | rio_dprintk (RIO_DEBUG_CTRL, "Clear interrupt for host %d\n", (int)arg); | 1240 | ** (probably for debug reasons) |
1635 | WBYTE((p->RIOHosts[(int)arg].ResetInt) , 0xff); | 1241 | */ |
1636 | return 0; | 1242 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_PORT\n"); |
1637 | 1243 | if (copyin((int) arg, (caddr_t) & PortReq, sizeof(PortReq)) == COPYFAIL) { | |
1638 | case RIO_READ_CHECK: | 1244 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_PORT: Copy in from user space failed\n"); |
1639 | /* Check reads for pkts with data[0] the same */ | 1245 | p->RIOError.Error = COPYIN_FAILED; |
1640 | p->RIOReadCheck = !p->RIOReadCheck; | 1246 | return -EFAULT; |
1641 | if (copyout((caddr_t)&p->RIOReadCheck,(int)arg, | 1247 | } |
1642 | sizeof(uint))== COPYFAIL) { | 1248 | |
1643 | p->RIOError.Error = COPYOUT_FAILED; | 1249 | if (PortReq.SysPort >= RIO_PORTS) { /* SysPort is unsigned */ |
1644 | return -EFAULT; | 1250 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_PORT: Illegal port number %d\n", PortReq.SysPort); |
1645 | } | 1251 | p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE; |
1646 | return 0; | 1252 | return -ENXIO; |
1647 | 1253 | } | |
1648 | case RIO_READ_REGISTER : | 1254 | rio_dprintk(RIO_DEBUG_CTRL, "Request for port %d\n", PortReq.SysPort); |
1649 | if (copyin((int)arg, (caddr_t)&SubCmd, | 1255 | if (copyout((caddr_t) p->RIOPortp[PortReq.SysPort], (int) PortReq.PortP, sizeof(struct Port)) == COPYFAIL) { |
1650 | sizeof(struct SubCmdStruct)) == COPYFAIL) { | 1256 | p->RIOError.Error = COPYOUT_FAILED; |
1651 | p->RIOError.Error = COPYIN_FAILED; | 1257 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_PORT: Bad copy to user space\n"); |
1652 | return -EFAULT; | 1258 | return -EFAULT; |
1653 | } | 1259 | } |
1654 | rio_dprintk (RIO_DEBUG_CTRL, "RIO_READ_REGISTER host %d rup %d port %d reg %x\n", | 1260 | return retval; |
1655 | SubCmd.Host, SubCmd.Rup, SubCmd.Port, SubCmd.Addr); | 1261 | |
1656 | 1262 | case RIO_HOST_RUP: | |
1657 | if (SubCmd.Port > 511) { | 1263 | /* |
1658 | rio_dprintk (RIO_DEBUG_CTRL, "Baud rate mapping: Bad port number %d\n", | 1264 | ** The daemon want rup information |
1659 | SubCmd.Port); | 1265 | ** (probably for debug reasons) |
1660 | p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE; | 1266 | */ |
1661 | return -EINVAL; | 1267 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_RUP\n"); |
1662 | } | 1268 | if (copyin((int) arg, (caddr_t) & RupReq, sizeof(RupReq)) == COPYFAIL) { |
1663 | 1269 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_RUP: Copy in from user space failed\n"); | |
1664 | if (SubCmd.Rup >= MAX_RUP+LINKS_PER_UNIT ) { | 1270 | p->RIOError.Error = COPYIN_FAILED; |
1665 | p->RIOError.Error = RUP_NUMBER_OUT_OF_RANGE; | 1271 | return -EFAULT; |
1666 | return -EINVAL; | 1272 | } |
1667 | } | 1273 | if (RupReq.HostNum >= p->RIONumHosts) { /* host is unsigned */ |
1668 | 1274 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_RUP: Illegal host number %d\n", RupReq.HostNum); | |
1669 | if (SubCmd.Host >= p->RIONumHosts ) { | 1275 | p->RIOError.Error = HOST_NUMBER_OUT_OF_RANGE; |
1670 | p->RIOError.Error = HOST_NUMBER_OUT_OF_RANGE; | 1276 | return -ENXIO; |
1671 | return -EINVAL; | 1277 | } |
1672 | } | 1278 | if (RupReq.RupNum >= MAX_RUP + LINKS_PER_UNIT) { /* eek! */ |
1673 | 1279 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_RUP: Illegal rup number %d\n", RupReq.RupNum); | |
1674 | port = p->RIOHosts[SubCmd.Host]. | 1280 | p->RIOError.Error = RUP_NUMBER_OUT_OF_RANGE; |
1675 | UnixRups[SubCmd.Rup].BaseSysPort + SubCmd.Port; | 1281 | return -EINVAL; |
1676 | PortP = p->RIOPortp[port]; | 1282 | } |
1677 | 1283 | HostP = &p->RIOHosts[RupReq.HostNum]; | |
1678 | rio_spin_lock_irqsave(&PortP->portSem, flags); | 1284 | |
1679 | 1285 | if ((HostP->Flags & RUN_STATE) != RC_RUNNING) { | |
1680 | if (RIOPreemptiveCmd(p, PortP, READ_REGISTER) == RIO_FAIL) { | 1286 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_RUP: Host %d not running\n", RupReq.HostNum); |
1681 | rio_dprintk (RIO_DEBUG_CTRL, "RIO_READ_REGISTER failed\n"); | 1287 | p->RIOError.Error = HOST_NOT_RUNNING; |
1682 | rio_spin_unlock_irqrestore( &PortP->portSem , flags); | 1288 | return -EIO; |
1683 | return -EBUSY; | 1289 | } |
1684 | } | 1290 | rio_dprintk(RIO_DEBUG_CTRL, "Request for rup %d from host %d\n", RupReq.RupNum, RupReq.HostNum); |
1685 | else | 1291 | |
1686 | PortP->State |= RIO_BUSY; | 1292 | if (copyout((caddr_t) HostP->UnixRups[RupReq.RupNum].RupP, (int) RupReq.RupP, sizeof(struct RUP)) == COPYFAIL) { |
1687 | 1293 | p->RIOError.Error = COPYOUT_FAILED; | |
1688 | rio_spin_unlock_irqrestore( &PortP->portSem , flags); | 1294 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_RUP: Bad copy to user space\n"); |
1689 | if (copyout((caddr_t)&p->CdRegister, (int)arg, | 1295 | return -EFAULT; |
1690 | sizeof(uint)) == COPYFAIL ) { | 1296 | } |
1691 | rio_dprintk (RIO_DEBUG_CTRL, "RIO_READ_REGISTER copy failed\n"); | 1297 | return retval; |
1692 | p->RIOError.Error = COPYOUT_FAILED; | 1298 | |
1693 | return -EFAULT; | 1299 | case RIO_HOST_LPB: |
1694 | } | 1300 | /* |
1695 | return 0; | 1301 | ** The daemon want lpb information |
1696 | /* | 1302 | ** (probably for debug reasons) |
1697 | ** rio_make_dev: given port number (0-511) ORed with port type | 1303 | */ |
1698 | ** (RIO_DEV_DIRECT, RIO_DEV_MODEM, RIO_DEV_XPRINT) return dev_t | 1304 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_LPB\n"); |
1699 | ** value to pass to mknod to create the correct device node. | 1305 | if (copyin((int) arg, (caddr_t) & LpbReq, sizeof(LpbReq)) == COPYFAIL) { |
1700 | */ | 1306 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_LPB: Bad copy from user space\n"); |
1701 | case RIO_MAKE_DEV: | 1307 | p->RIOError.Error = COPYIN_FAILED; |
1702 | { | 1308 | return -EFAULT; |
1703 | uint port = (uint)arg & RIO_MODEM_MASK; | 1309 | } |
1704 | 1310 | if (LpbReq.Host >= p->RIONumHosts) { /* host is unsigned */ | |
1705 | switch ( (uint)arg & RIO_DEV_MASK ) { | 1311 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_LPB: Illegal host number %d\n", LpbReq.Host); |
1706 | case RIO_DEV_DIRECT: | 1312 | p->RIOError.Error = HOST_NUMBER_OUT_OF_RANGE; |
1707 | arg = (caddr_t)drv_makedev(MAJOR(dev), port); | 1313 | return -ENXIO; |
1708 | rio_dprintk (RIO_DEBUG_CTRL, "Makedev direct 0x%x is 0x%x\n",port, (int)arg); | 1314 | } |
1709 | return (int)arg; | 1315 | if (LpbReq.Link >= LINKS_PER_UNIT) { /* eek! */ |
1710 | case RIO_DEV_MODEM: | 1316 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_LPB: Illegal link number %d\n", LpbReq.Link); |
1711 | arg = (caddr_t)drv_makedev(MAJOR(dev), (port|RIO_MODEM_BIT) ); | 1317 | p->RIOError.Error = LINK_NUMBER_OUT_OF_RANGE; |
1712 | rio_dprintk (RIO_DEBUG_CTRL, "Makedev modem 0x%x is 0x%x\n",port, (int)arg); | 1318 | return -EINVAL; |
1713 | return (int)arg; | 1319 | } |
1714 | case RIO_DEV_XPRINT: | 1320 | HostP = &p->RIOHosts[LpbReq.Host]; |
1715 | arg = (caddr_t)drv_makedev(MAJOR(dev), port); | 1321 | |
1716 | rio_dprintk (RIO_DEBUG_CTRL, "Makedev printer 0x%x is 0x%x\n",port, (int)arg); | 1322 | if ((HostP->Flags & RUN_STATE) != RC_RUNNING) { |
1717 | return (int)arg; | 1323 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_LPB: Host %d not running\n", LpbReq.Host); |
1718 | } | 1324 | p->RIOError.Error = HOST_NOT_RUNNING; |
1719 | rio_dprintk (RIO_DEBUG_CTRL, "MAKE Device is called\n"); | 1325 | return -EIO; |
1720 | return -EINVAL; | 1326 | } |
1721 | } | 1327 | rio_dprintk(RIO_DEBUG_CTRL, "Request for lpb %d from host %d\n", LpbReq.Link, LpbReq.Host); |
1722 | /* | 1328 | |
1723 | ** rio_minor: given a dev_t from a stat() call, return | 1329 | if (copyout((caddr_t) & HostP->LinkStrP[LpbReq.Link], (int) LpbReq.LpbP, sizeof(struct LPB)) == COPYFAIL) { |
1724 | ** the port number (0-511) ORed with the port type | 1330 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_LPB: Bad copy to user space\n"); |
1725 | ** ( RIO_DEV_DIRECT, RIO_DEV_MODEM, RIO_DEV_XPRINT ) | 1331 | p->RIOError.Error = COPYOUT_FAILED; |
1726 | */ | 1332 | return -EFAULT; |
1727 | case RIO_MINOR: | 1333 | } |
1728 | { | 1334 | return retval; |
1729 | dev_t dv; | ||
1730 | int mino; | ||
1731 | |||
1732 | dv = (dev_t)((int)arg); | ||
1733 | mino = RIO_UNMODEM(dv); | ||
1734 | 1335 | ||
1735 | if ( RIO_ISMODEM(dv) ) { | 1336 | /* |
1736 | rio_dprintk (RIO_DEBUG_CTRL, "Minor for device 0x%x: modem %d\n", dv, mino); | 1337 | ** Here 3 IOCTL's that allow us to change the way in which |
1737 | arg = (caddr_t)(mino | RIO_DEV_MODEM); | 1338 | ** rio logs errors. send them just to syslog or send them |
1738 | } | 1339 | ** to both syslog and console or send them to just the console. |
1739 | else { | 1340 | ** |
1740 | rio_dprintk (RIO_DEBUG_CTRL, "Minor for device 0x%x: direct %d\n", dv, mino); | 1341 | ** See RioStrBuf() in util.c for the other half. |
1741 | arg = (caddr_t)(mino | RIO_DEV_DIRECT); | 1342 | */ |
1742 | } | 1343 | case RIO_SYSLOG_ONLY: |
1743 | return (int)arg; | 1344 | p->RIOPrintLogState = PRINT_TO_LOG; /* Just syslog */ |
1744 | } | 1345 | return 0; |
1346 | |||
1347 | case RIO_SYSLOG_CONS: | ||
1348 | p->RIOPrintLogState = PRINT_TO_LOG_CONS; /* syslog and console */ | ||
1349 | return 0; | ||
1350 | |||
1351 | case RIO_CONS_ONLY: | ||
1352 | p->RIOPrintLogState = PRINT_TO_CONS; /* Just console */ | ||
1353 | return 0; | ||
1354 | |||
1355 | case RIO_SIGNALS_ON: | ||
1356 | if (p->RIOSignalProcess) { | ||
1357 | p->RIOError.Error = SIGNALS_ALREADY_SET; | ||
1358 | return -EBUSY; | ||
1359 | } | ||
1360 | p->RIOSignalProcess = getpid(); | ||
1361 | p->RIOPrintDisabled = DONT_PRINT; | ||
1362 | return retval; | ||
1363 | |||
1364 | case RIO_SIGNALS_OFF: | ||
1365 | if (p->RIOSignalProcess != getpid()) { | ||
1366 | p->RIOError.Error = NOT_RECEIVING_PROCESS; | ||
1367 | return -EPERM; | ||
1368 | } | ||
1369 | rio_dprintk(RIO_DEBUG_CTRL, "Clear signal process to zero\n"); | ||
1370 | p->RIOSignalProcess = 0; | ||
1371 | return retval; | ||
1372 | |||
1373 | case RIO_SET_BYTE_MODE: | ||
1374 | for (Host = 0; Host < p->RIONumHosts; Host++) | ||
1375 | if (p->RIOHosts[Host].Type == RIO_AT) | ||
1376 | p->RIOHosts[Host].Mode &= ~WORD_OPERATION; | ||
1377 | return retval; | ||
1378 | |||
1379 | case RIO_SET_WORD_MODE: | ||
1380 | for (Host = 0; Host < p->RIONumHosts; Host++) | ||
1381 | if (p->RIOHosts[Host].Type == RIO_AT) | ||
1382 | p->RIOHosts[Host].Mode |= WORD_OPERATION; | ||
1383 | return retval; | ||
1384 | |||
1385 | case RIO_SET_FAST_BUS: | ||
1386 | for (Host = 0; Host < p->RIONumHosts; Host++) | ||
1387 | if (p->RIOHosts[Host].Type == RIO_AT) | ||
1388 | p->RIOHosts[Host].Mode |= FAST_AT_BUS; | ||
1389 | return retval; | ||
1390 | |||
1391 | case RIO_SET_SLOW_BUS: | ||
1392 | for (Host = 0; Host < p->RIONumHosts; Host++) | ||
1393 | if (p->RIOHosts[Host].Type == RIO_AT) | ||
1394 | p->RIOHosts[Host].Mode &= ~FAST_AT_BUS; | ||
1395 | return retval; | ||
1396 | |||
1397 | case RIO_MAP_B50_TO_50: | ||
1398 | case RIO_MAP_B50_TO_57600: | ||
1399 | case RIO_MAP_B110_TO_110: | ||
1400 | case RIO_MAP_B110_TO_115200: | ||
1401 | rio_dprintk(RIO_DEBUG_CTRL, "Baud rate mapping\n"); | ||
1402 | port = (uint) arg; | ||
1403 | if (port < 0 || port > 511) { | ||
1404 | rio_dprintk(RIO_DEBUG_CTRL, "Baud rate mapping: Bad port number %d\n", port); | ||
1405 | p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE; | ||
1406 | return -EINVAL; | ||
1407 | } | ||
1408 | rio_spin_lock_irqsave(&PortP->portSem, flags); | ||
1409 | switch (cmd) { | ||
1410 | case RIO_MAP_B50_TO_50: | ||
1411 | p->RIOPortp[port]->Config |= RIO_MAP_50_TO_50; | ||
1412 | break; | ||
1413 | case RIO_MAP_B50_TO_57600: | ||
1414 | p->RIOPortp[port]->Config &= ~RIO_MAP_50_TO_50; | ||
1415 | break; | ||
1416 | case RIO_MAP_B110_TO_110: | ||
1417 | p->RIOPortp[port]->Config |= RIO_MAP_110_TO_110; | ||
1418 | break; | ||
1419 | case RIO_MAP_B110_TO_115200: | ||
1420 | p->RIOPortp[port]->Config &= ~RIO_MAP_110_TO_110; | ||
1421 | break; | ||
1422 | } | ||
1423 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | ||
1424 | return retval; | ||
1425 | |||
1426 | case RIO_STREAM_INFO: | ||
1427 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_STREAM_INFO\n"); | ||
1428 | return -EINVAL; | ||
1429 | |||
1430 | case RIO_SEND_PACKET: | ||
1431 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_SEND_PACKET\n"); | ||
1432 | if (copyin((int) arg, (caddr_t) & SendPack, sizeof(SendPack)) == COPYFAIL) { | ||
1433 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_SEND_PACKET: Bad copy from user space\n"); | ||
1434 | p->RIOError.Error = COPYIN_FAILED; | ||
1435 | return -EFAULT; | ||
1436 | } | ||
1437 | if (SendPack.PortNum >= 128) { | ||
1438 | p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE; | ||
1439 | return -ENXIO; | ||
1440 | } | ||
1441 | |||
1442 | PortP = p->RIOPortp[SendPack.PortNum]; | ||
1443 | rio_spin_lock_irqsave(&PortP->portSem, flags); | ||
1444 | |||
1445 | if (!can_add_transmit(&PacketP, PortP)) { | ||
1446 | p->RIOError.Error = UNIT_IS_IN_USE; | ||
1447 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | ||
1448 | return -ENOSPC; | ||
1449 | } | ||
1450 | |||
1451 | for (loop = 0; loop < (ushort) (SendPack.Len & 127); loop++) | ||
1452 | WBYTE(PacketP->data[loop], SendPack.Data[loop]); | ||
1453 | |||
1454 | WBYTE(PacketP->len, SendPack.Len); | ||
1455 | |||
1456 | add_transmit(PortP); | ||
1457 | /* | ||
1458 | ** Count characters transmitted for port statistics reporting | ||
1459 | */ | ||
1460 | if (PortP->statsGather) | ||
1461 | PortP->txchars += (SendPack.Len & 127); | ||
1462 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | ||
1463 | return retval; | ||
1464 | |||
1465 | case RIO_NO_MESG: | ||
1466 | if (su) | ||
1467 | p->RIONoMessage = 1; | ||
1468 | return su ? 0 : -EPERM; | ||
1469 | |||
1470 | case RIO_MESG: | ||
1471 | if (su) | ||
1472 | p->RIONoMessage = 0; | ||
1473 | return su ? 0 : -EPERM; | ||
1474 | |||
1475 | case RIO_WHAT_MESG: | ||
1476 | if (copyout((caddr_t) & p->RIONoMessage, (int) arg, sizeof(p->RIONoMessage)) == COPYFAIL) { | ||
1477 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_WHAT_MESG: Bad copy to user space\n"); | ||
1478 | p->RIOError.Error = COPYOUT_FAILED; | ||
1479 | return -EFAULT; | ||
1480 | } | ||
1481 | return 0; | ||
1482 | |||
1483 | case RIO_MEM_DUMP: | ||
1484 | if (copyin((int) arg, (caddr_t) & SubCmd, sizeof(struct SubCmdStruct)) == COPYFAIL) { | ||
1485 | p->RIOError.Error = COPYIN_FAILED; | ||
1486 | return -EFAULT; | ||
1487 | } | ||
1488 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_MEM_DUMP host %d rup %d addr %x\n", SubCmd.Host, SubCmd.Rup, SubCmd.Addr); | ||
1489 | |||
1490 | if (SubCmd.Rup >= MAX_RUP + LINKS_PER_UNIT) { | ||
1491 | p->RIOError.Error = RUP_NUMBER_OUT_OF_RANGE; | ||
1492 | return -EINVAL; | ||
1493 | } | ||
1494 | |||
1495 | if (SubCmd.Host >= p->RIONumHosts) { | ||
1496 | p->RIOError.Error = HOST_NUMBER_OUT_OF_RANGE; | ||
1497 | return -EINVAL; | ||
1498 | } | ||
1499 | |||
1500 | port = p->RIOHosts[SubCmd.Host].UnixRups[SubCmd.Rup].BaseSysPort; | ||
1501 | |||
1502 | PortP = p->RIOPortp[port]; | ||
1503 | |||
1504 | rio_spin_lock_irqsave(&PortP->portSem, flags); | ||
1505 | |||
1506 | if (RIOPreemptiveCmd(p, PortP, MEMDUMP) == RIO_FAIL) { | ||
1507 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_MEM_DUMP failed\n"); | ||
1508 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | ||
1509 | return -EBUSY; | ||
1510 | } else | ||
1511 | PortP->State |= RIO_BUSY; | ||
1512 | |||
1513 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | ||
1514 | if (copyout((caddr_t) p->RIOMemDump, (int) arg, MEMDUMP_SIZE) == COPYFAIL) { | ||
1515 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_MEM_DUMP copy failed\n"); | ||
1516 | p->RIOError.Error = COPYOUT_FAILED; | ||
1517 | return -EFAULT; | ||
1518 | } | ||
1519 | return 0; | ||
1520 | |||
1521 | case RIO_TICK: | ||
1522 | if ((int) arg < 0 || (int) arg >= p->RIONumHosts) | ||
1523 | return -EINVAL; | ||
1524 | rio_dprintk(RIO_DEBUG_CTRL, "Set interrupt for host %d\n", (int) arg); | ||
1525 | WBYTE(p->RIOHosts[(int) arg].SetInt, 0xff); | ||
1526 | return 0; | ||
1527 | |||
1528 | case RIO_TOCK: | ||
1529 | if ((int) arg < 0 || (int) arg >= p->RIONumHosts) | ||
1530 | return -EINVAL; | ||
1531 | rio_dprintk(RIO_DEBUG_CTRL, "Clear interrupt for host %d\n", (int) arg); | ||
1532 | WBYTE((p->RIOHosts[(int) arg].ResetInt), 0xff); | ||
1533 | return 0; | ||
1534 | |||
1535 | case RIO_READ_CHECK: | ||
1536 | /* Check reads for pkts with data[0] the same */ | ||
1537 | p->RIOReadCheck = !p->RIOReadCheck; | ||
1538 | if (copyout((caddr_t) & p->RIOReadCheck, (int) arg, sizeof(uint)) == COPYFAIL) { | ||
1539 | p->RIOError.Error = COPYOUT_FAILED; | ||
1540 | return -EFAULT; | ||
1541 | } | ||
1542 | return 0; | ||
1543 | |||
1544 | case RIO_READ_REGISTER: | ||
1545 | if (copyin((int) arg, (caddr_t) & SubCmd, sizeof(struct SubCmdStruct)) == COPYFAIL) { | ||
1546 | p->RIOError.Error = COPYIN_FAILED; | ||
1547 | return -EFAULT; | ||
1548 | } | ||
1549 | 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); | ||
1550 | |||
1551 | if (SubCmd.Port > 511) { | ||
1552 | rio_dprintk(RIO_DEBUG_CTRL, "Baud rate mapping: Bad port number %d\n", SubCmd.Port); | ||
1553 | p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE; | ||
1554 | return -EINVAL; | ||
1555 | } | ||
1556 | |||
1557 | if (SubCmd.Rup >= MAX_RUP + LINKS_PER_UNIT) { | ||
1558 | p->RIOError.Error = RUP_NUMBER_OUT_OF_RANGE; | ||
1559 | return -EINVAL; | ||
1560 | } | ||
1561 | |||
1562 | if (SubCmd.Host >= p->RIONumHosts) { | ||
1563 | p->RIOError.Error = HOST_NUMBER_OUT_OF_RANGE; | ||
1564 | return -EINVAL; | ||
1565 | } | ||
1566 | |||
1567 | port = p->RIOHosts[SubCmd.Host].UnixRups[SubCmd.Rup].BaseSysPort + SubCmd.Port; | ||
1568 | PortP = p->RIOPortp[port]; | ||
1569 | |||
1570 | rio_spin_lock_irqsave(&PortP->portSem, flags); | ||
1571 | |||
1572 | if (RIOPreemptiveCmd(p, PortP, READ_REGISTER) == RIO_FAIL) { | ||
1573 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_READ_REGISTER failed\n"); | ||
1574 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | ||
1575 | return -EBUSY; | ||
1576 | } else | ||
1577 | PortP->State |= RIO_BUSY; | ||
1578 | |||
1579 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | ||
1580 | if (copyout((caddr_t) & p->CdRegister, (int) arg, sizeof(uint)) == COPYFAIL) { | ||
1581 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_READ_REGISTER copy failed\n"); | ||
1582 | p->RIOError.Error = COPYOUT_FAILED; | ||
1583 | return -EFAULT; | ||
1584 | } | ||
1585 | return 0; | ||
1586 | /* | ||
1587 | ** rio_make_dev: given port number (0-511) ORed with port type | ||
1588 | ** (RIO_DEV_DIRECT, RIO_DEV_MODEM, RIO_DEV_XPRINT) return dev_t | ||
1589 | ** value to pass to mknod to create the correct device node. | ||
1590 | */ | ||
1591 | case RIO_MAKE_DEV: | ||
1592 | { | ||
1593 | uint port = (uint) arg & RIO_MODEM_MASK; | ||
1594 | |||
1595 | switch ((uint) arg & RIO_DEV_MASK) { | ||
1596 | case RIO_DEV_DIRECT: | ||
1597 | arg = (caddr_t) drv_makedev(MAJOR(dev), port); | ||
1598 | rio_dprintk(RIO_DEBUG_CTRL, "Makedev direct 0x%x is 0x%x\n", port, (int) arg); | ||
1599 | return (int) arg; | ||
1600 | case RIO_DEV_MODEM: | ||
1601 | arg = (caddr_t) drv_makedev(MAJOR(dev), (port | RIO_MODEM_BIT)); | ||
1602 | rio_dprintk(RIO_DEBUG_CTRL, "Makedev modem 0x%x is 0x%x\n", port, (int) arg); | ||
1603 | return (int) arg; | ||
1604 | case RIO_DEV_XPRINT: | ||
1605 | arg = (caddr_t) drv_makedev(MAJOR(dev), port); | ||
1606 | rio_dprintk(RIO_DEBUG_CTRL, "Makedev printer 0x%x is 0x%x\n", port, (int) arg); | ||
1607 | return (int) arg; | ||
1608 | } | ||
1609 | rio_dprintk(RIO_DEBUG_CTRL, "MAKE Device is called\n"); | ||
1610 | return -EINVAL; | ||
1611 | } | ||
1612 | /* | ||
1613 | ** rio_minor: given a dev_t from a stat() call, return | ||
1614 | ** the port number (0-511) ORed with the port type | ||
1615 | ** ( RIO_DEV_DIRECT, RIO_DEV_MODEM, RIO_DEV_XPRINT ) | ||
1616 | */ | ||
1617 | case RIO_MINOR: | ||
1618 | { | ||
1619 | dev_t dv; | ||
1620 | int mino; | ||
1621 | |||
1622 | dv = (dev_t) ((int) arg); | ||
1623 | mino = RIO_UNMODEM(dv); | ||
1624 | |||
1625 | if (RIO_ISMODEM(dv)) { | ||
1626 | rio_dprintk(RIO_DEBUG_CTRL, "Minor for device 0x%x: modem %d\n", dv, mino); | ||
1627 | arg = (caddr_t) (mino | RIO_DEV_MODEM); | ||
1628 | } else { | ||
1629 | rio_dprintk(RIO_DEBUG_CTRL, "Minor for device 0x%x: direct %d\n", dv, mino); | ||
1630 | arg = (caddr_t) (mino | RIO_DEV_DIRECT); | ||
1631 | } | ||
1632 | return (int) arg; | ||
1633 | } | ||
1745 | } | 1634 | } |
1746 | rio_dprintk (RIO_DEBUG_CTRL, "INVALID DAEMON IOCTL 0x%x\n",cmd); | 1635 | rio_dprintk(RIO_DEBUG_CTRL, "INVALID DAEMON IOCTL 0x%x\n", cmd); |
1747 | p->RIOError.Error = IOCTL_COMMAND_UNKNOWN; | 1636 | p->RIOError.Error = IOCTL_COMMAND_UNKNOWN; |
1748 | 1637 | ||
1749 | func_exit (); | 1638 | func_exit(); |
1750 | return -EINVAL; | 1639 | return -EINVAL; |
1751 | } | 1640 | } |
1752 | 1641 | ||
1753 | /* | 1642 | /* |
1754 | ** Pre-emptive commands go on RUPs and are only one byte long. | 1643 | ** Pre-emptive commands go on RUPs and are only one byte long. |
1755 | */ | 1644 | */ |
1756 | int | 1645 | int RIOPreemptiveCmd(p, PortP, Cmd) |
1757 | RIOPreemptiveCmd(p, PortP, Cmd) | 1646 | struct rio_info *p; |
1758 | struct rio_info * p; | ||
1759 | struct Port *PortP; | 1647 | struct Port *PortP; |
1760 | uchar Cmd; | 1648 | uchar Cmd; |
1761 | { | 1649 | { |
@@ -1766,104 +1654,99 @@ uchar Cmd; | |||
1766 | int port; | 1654 | int port; |
1767 | 1655 | ||
1768 | #ifdef CHECK | 1656 | #ifdef CHECK |
1769 | CheckPortP( PortP ); | 1657 | CheckPortP(PortP); |
1770 | #endif | 1658 | #endif |
1771 | 1659 | ||
1772 | if ( PortP->State & RIO_DELETED ) { | 1660 | if (PortP->State & RIO_DELETED) { |
1773 | rio_dprintk (RIO_DEBUG_CTRL, "Preemptive command to deleted RTA ignored\n"); | 1661 | rio_dprintk(RIO_DEBUG_CTRL, "Preemptive command to deleted RTA ignored\n"); |
1774 | return RIO_FAIL; | 1662 | return RIO_FAIL; |
1775 | } | 1663 | } |
1776 | 1664 | ||
1777 | if (((int)((char)PortP->InUse) == -1) || ! (CmdBlkP = RIOGetCmdBlk()) ) { | 1665 | if (((int) ((char) PortP->InUse) == -1) || !(CmdBlkP = RIOGetCmdBlk())) { |
1778 | rio_dprintk (RIO_DEBUG_CTRL, "Cannot allocate command block for command %d on port %d\n", | 1666 | rio_dprintk(RIO_DEBUG_CTRL, "Cannot allocate command block for command %d on port %d\n", Cmd, PortP->PortNum); |
1779 | Cmd, PortP->PortNum); | ||
1780 | return RIO_FAIL; | 1667 | return RIO_FAIL; |
1781 | } | 1668 | } |
1782 | 1669 | ||
1783 | rio_dprintk (RIO_DEBUG_CTRL, "Command blk 0x%x - InUse now %d\n", | 1670 | rio_dprintk(RIO_DEBUG_CTRL, "Command blk 0x%x - InUse now %d\n", (int) CmdBlkP, PortP->InUse); |
1784 | (int)CmdBlkP,PortP->InUse); | ||
1785 | 1671 | ||
1786 | PktCmdP = (struct PktCmd_M *)&CmdBlkP->Packet.data[0]; | 1672 | PktCmdP = (struct PktCmd_M *) &CmdBlkP->Packet.data[0]; |
1787 | 1673 | ||
1788 | CmdBlkP->Packet.src_unit = 0; | 1674 | CmdBlkP->Packet.src_unit = 0; |
1789 | if (PortP->SecondBlock) | 1675 | if (PortP->SecondBlock) |
1790 | rup = PortP->ID2; | 1676 | rup = PortP->ID2; |
1791 | else | 1677 | else |
1792 | rup = PortP->RupNum; | 1678 | rup = PortP->RupNum; |
1793 | CmdBlkP->Packet.dest_unit = rup; | 1679 | CmdBlkP->Packet.dest_unit = rup; |
1794 | CmdBlkP->Packet.src_port = COMMAND_RUP; | 1680 | CmdBlkP->Packet.src_port = COMMAND_RUP; |
1795 | CmdBlkP->Packet.dest_port = COMMAND_RUP; | 1681 | CmdBlkP->Packet.dest_port = COMMAND_RUP; |
1796 | CmdBlkP->Packet.len = PKT_CMD_BIT | 2; | 1682 | CmdBlkP->Packet.len = PKT_CMD_BIT | 2; |
1797 | CmdBlkP->PostFuncP = RIOUnUse; | 1683 | CmdBlkP->PostFuncP = RIOUnUse; |
1798 | CmdBlkP->PostArg = (int)PortP; | 1684 | CmdBlkP->PostArg = (int) PortP; |
1799 | PktCmdP->Command = Cmd; | 1685 | PktCmdP->Command = Cmd; |
1800 | port = PortP->HostPort % (ushort)PORTS_PER_RTA; | 1686 | port = PortP->HostPort % (ushort) PORTS_PER_RTA; |
1801 | /* | 1687 | /* |
1802 | ** Index ports 8-15 for 2nd block of 16 port RTA. | 1688 | ** Index ports 8-15 for 2nd block of 16 port RTA. |
1803 | */ | 1689 | */ |
1804 | if (PortP->SecondBlock) | 1690 | if (PortP->SecondBlock) |
1805 | port += (ushort) PORTS_PER_RTA; | 1691 | port += (ushort) PORTS_PER_RTA; |
1806 | PktCmdP->PhbNum = port; | 1692 | PktCmdP->PhbNum = port; |
1807 | 1693 | ||
1808 | switch ( Cmd ) { | 1694 | switch (Cmd) { |
1809 | case MEMDUMP: | 1695 | case MEMDUMP: |
1810 | rio_dprintk (RIO_DEBUG_CTRL, "Queue MEMDUMP command blk 0x%x (addr 0x%x)\n", | 1696 | rio_dprintk(RIO_DEBUG_CTRL, "Queue MEMDUMP command blk 0x%x (addr 0x%x)\n", (int) CmdBlkP, (int) SubCmd.Addr); |
1811 | (int)CmdBlkP, (int)SubCmd.Addr); | 1697 | PktCmdP->SubCommand = MEMDUMP; |
1812 | PktCmdP->SubCommand = MEMDUMP; | 1698 | PktCmdP->SubAddr = SubCmd.Addr; |
1813 | PktCmdP->SubAddr = SubCmd.Addr; | 1699 | break; |
1814 | break; | 1700 | case FCLOSE: |
1815 | case FCLOSE: | 1701 | rio_dprintk(RIO_DEBUG_CTRL, "Queue FCLOSE command blk 0x%x\n", (int) CmdBlkP); |
1816 | rio_dprintk (RIO_DEBUG_CTRL, "Queue FCLOSE command blk 0x%x\n",(int)CmdBlkP); | 1702 | break; |
1817 | break; | 1703 | case READ_REGISTER: |
1818 | case READ_REGISTER: | 1704 | rio_dprintk(RIO_DEBUG_CTRL, "Queue READ_REGISTER (0x%x) command blk 0x%x\n", (int) SubCmd.Addr, (int) CmdBlkP); |
1819 | rio_dprintk (RIO_DEBUG_CTRL, "Queue READ_REGISTER (0x%x) command blk 0x%x\n", | 1705 | PktCmdP->SubCommand = READ_REGISTER; |
1820 | (int)SubCmd.Addr, (int)CmdBlkP); | 1706 | PktCmdP->SubAddr = SubCmd.Addr; |
1821 | PktCmdP->SubCommand = READ_REGISTER; | 1707 | break; |
1822 | PktCmdP->SubAddr = SubCmd.Addr; | 1708 | case RESUME: |
1823 | break; | 1709 | rio_dprintk(RIO_DEBUG_CTRL, "Queue RESUME command blk 0x%x\n", (int) CmdBlkP); |
1824 | case RESUME: | 1710 | break; |
1825 | rio_dprintk (RIO_DEBUG_CTRL, "Queue RESUME command blk 0x%x\n",(int)CmdBlkP); | 1711 | case RFLUSH: |
1826 | break; | 1712 | rio_dprintk(RIO_DEBUG_CTRL, "Queue RFLUSH command blk 0x%x\n", (int) CmdBlkP); |
1827 | case RFLUSH: | 1713 | CmdBlkP->PostFuncP = RIORFlushEnable; |
1828 | rio_dprintk (RIO_DEBUG_CTRL, "Queue RFLUSH command blk 0x%x\n",(int)CmdBlkP); | 1714 | break; |
1829 | CmdBlkP->PostFuncP = RIORFlushEnable; | 1715 | case SUSPEND: |
1830 | break; | 1716 | rio_dprintk(RIO_DEBUG_CTRL, "Queue SUSPEND command blk 0x%x\n", (int) CmdBlkP); |
1831 | case SUSPEND: | 1717 | break; |
1832 | rio_dprintk (RIO_DEBUG_CTRL, "Queue SUSPEND command blk 0x%x\n",(int)CmdBlkP); | 1718 | |
1833 | break; | 1719 | case MGET: |
1834 | 1720 | rio_dprintk(RIO_DEBUG_CTRL, "Queue MGET command blk 0x%x\n", (int) CmdBlkP); | |
1835 | case MGET : | 1721 | break; |
1836 | rio_dprintk (RIO_DEBUG_CTRL, "Queue MGET command blk 0x%x\n", (int)CmdBlkP); | 1722 | |
1837 | break; | 1723 | case MSET: |
1838 | 1724 | case MBIC: | |
1839 | case MSET : | 1725 | case MBIS: |
1840 | case MBIC : | 1726 | CmdBlkP->Packet.data[4] = (char) PortP->ModemLines; |
1841 | case MBIS : | 1727 | rio_dprintk(RIO_DEBUG_CTRL, "Queue MSET/MBIC/MBIS command blk 0x%x\n", (int) CmdBlkP); |
1842 | CmdBlkP->Packet.data[4] = (char) PortP->ModemLines; | 1728 | break; |
1843 | rio_dprintk (RIO_DEBUG_CTRL, "Queue MSET/MBIC/MBIS command blk 0x%x\n", (int)CmdBlkP); | 1729 | |
1844 | break; | 1730 | case WFLUSH: |
1845 | 1731 | /* | |
1846 | case WFLUSH: | 1732 | ** If we have queued up the maximum number of Write flushes |
1847 | /* | 1733 | ** allowed then we should not bother sending any more to the |
1848 | ** If we have queued up the maximum number of Write flushes | 1734 | ** RTA. |
1849 | ** allowed then we should not bother sending any more to the | 1735 | */ |
1850 | ** RTA. | 1736 | if ((int) ((char) PortP->WflushFlag) == (int) -1) { |
1851 | */ | 1737 | rio_dprintk(RIO_DEBUG_CTRL, "Trashed WFLUSH, WflushFlag about to wrap!"); |
1852 | if ((int)((char)PortP->WflushFlag) == (int)-1) { | 1738 | RIOFreeCmdBlk(CmdBlkP); |
1853 | rio_dprintk (RIO_DEBUG_CTRL, "Trashed WFLUSH, WflushFlag about to wrap!"); | 1739 | return (RIO_FAIL); |
1854 | RIOFreeCmdBlk(CmdBlkP); | 1740 | } else { |
1855 | return(RIO_FAIL); | 1741 | rio_dprintk(RIO_DEBUG_CTRL, "Queue WFLUSH command blk 0x%x\n", (int) CmdBlkP); |
1856 | } else { | 1742 | CmdBlkP->PostFuncP = RIOWFlushMark; |
1857 | rio_dprintk (RIO_DEBUG_CTRL, "Queue WFLUSH command blk 0x%x\n", | 1743 | } |
1858 | (int)CmdBlkP); | 1744 | break; |
1859 | CmdBlkP->PostFuncP = RIOWFlushMark; | ||
1860 | } | ||
1861 | break; | ||
1862 | } | 1745 | } |
1863 | 1746 | ||
1864 | PortP->InUse++; | 1747 | PortP->InUse++; |
1865 | 1748 | ||
1866 | Ret = RIOQueueCmdBlk( PortP->HostP, rup, CmdBlkP ); | 1749 | Ret = RIOQueueCmdBlk(PortP->HostP, rup, CmdBlkP); |
1867 | 1750 | ||
1868 | return Ret; | 1751 | return Ret; |
1869 | } | 1752 | } |
diff --git a/drivers/char/rio/riodrvr.h b/drivers/char/rio/riodrvr.h index bc38ac5dfbde..663ee0914ed7 100644 --- a/drivers/char/rio/riodrvr.h +++ b/drivers/char/rio/riodrvr.h | |||
@@ -33,7 +33,7 @@ | |||
33 | #ifndef __riodrvr_h | 33 | #ifndef __riodrvr_h |
34 | #define __riodrvr_h | 34 | #define __riodrvr_h |
35 | 35 | ||
36 | #include <asm/param.h> /* for HZ */ | 36 | #include <asm/param.h> /* for HZ */ |
37 | 37 | ||
38 | #ifdef SCCS_LABELS | 38 | #ifdef SCCS_LABELS |
39 | static char *_riodrvr_h_sccs_ = "@(#)riodrvr.h 1.3"; | 39 | static char *_riodrvr_h_sccs_ = "@(#)riodrvr.h 1.3"; |
@@ -44,15 +44,15 @@ static char *_riodrvr_h_sccs_ = "@(#)riodrvr.h 1.3"; | |||
44 | 44 | ||
45 | 45 | ||
46 | struct rio_info { | 46 | struct rio_info { |
47 | int mode; /* Intr or polled, word/byte */ | 47 | int mode; /* Intr or polled, word/byte */ |
48 | spinlock_t RIOIntrSem; /* Interrupt thread sem */ | 48 | spinlock_t RIOIntrSem; /* Interrupt thread sem */ |
49 | int current_chan; /* current channel */ | 49 | int current_chan; /* current channel */ |
50 | int RIOFailed; /* Not initialised ? */ | 50 | int RIOFailed; /* Not initialised ? */ |
51 | int RIOInstallAttempts; /* no. of rio-install() calls */ | 51 | int RIOInstallAttempts; /* no. of rio-install() calls */ |
52 | int RIOLastPCISearch; /* status of last search */ | 52 | int RIOLastPCISearch; /* status of last search */ |
53 | int RIONumHosts; /* Number of RIO Hosts */ | 53 | int RIONumHosts; /* Number of RIO Hosts */ |
54 | struct Host * RIOHosts; /* RIO Host values */ | 54 | struct Host *RIOHosts; /* RIO Host values */ |
55 | struct Port **RIOPortp; /* RIO port values */ | 55 | struct Port **RIOPortp; /* RIO port values */ |
56 | /* | 56 | /* |
57 | ** 02.03.1999 ARG - ESIL 0820 fix | 57 | ** 02.03.1999 ARG - ESIL 0820 fix |
58 | ** We no longer use RIOBootMode | 58 | ** We no longer use RIOBootMode |
@@ -60,9 +60,9 @@ struct rio_info { | |||
60 | int RIOBootMode; * RIO boot mode * | 60 | int RIOBootMode; * RIO boot mode * |
61 | ** | 61 | ** |
62 | */ | 62 | */ |
63 | int RIOPrintDisabled; /* RIO printing disabled ? */ | 63 | int RIOPrintDisabled; /* RIO printing disabled ? */ |
64 | int RIOPrintLogState; /* RIO printing state ? */ | 64 | int RIOPrintLogState; /* RIO printing state ? */ |
65 | int RIOPolling; /* Polling ? */ | 65 | int RIOPolling; /* Polling ? */ |
66 | /* | 66 | /* |
67 | ** 09.12.1998 ARG - ESIL 0776 part fix | 67 | ** 09.12.1998 ARG - ESIL 0776 part fix |
68 | ** The 'RIO_QUICK_CHECK' ioctl was using RIOHalted. | 68 | ** The 'RIO_QUICK_CHECK' ioctl was using RIOHalted. |
@@ -70,61 +70,61 @@ struct rio_info { | |||
70 | ** updated in RIOConCon() - to keep track of RTA connections/disconnections. | 70 | ** updated in RIOConCon() - to keep track of RTA connections/disconnections. |
71 | ** 'RIO_QUICK_CHECK' now returns the value of RIORtaDisCons. | 71 | ** 'RIO_QUICK_CHECK' now returns the value of RIORtaDisCons. |
72 | */ | 72 | */ |
73 | int RIOHalted; /* halted ? */ | 73 | int RIOHalted; /* halted ? */ |
74 | int RIORtaDisCons; /* RTA connections/disconnections */ | 74 | int RIORtaDisCons; /* RTA connections/disconnections */ |
75 | uint RIOReadCheck; /* Rio read check */ | 75 | uint RIOReadCheck; /* Rio read check */ |
76 | uint RIONoMessage; /* To display message or not */ | 76 | uint RIONoMessage; /* To display message or not */ |
77 | uint RIONumBootPkts; /* how many packets for an RTA */ | 77 | uint RIONumBootPkts; /* how many packets for an RTA */ |
78 | uint RIOBootCount; /* size of RTA code */ | 78 | uint RIOBootCount; /* size of RTA code */ |
79 | uint RIOBooting; /* count of outstanding boots */ | 79 | uint RIOBooting; /* count of outstanding boots */ |
80 | uint RIOSystemUp; /* Booted ?? */ | 80 | uint RIOSystemUp; /* Booted ?? */ |
81 | uint RIOCounting; /* for counting interrupts */ | 81 | uint RIOCounting; /* for counting interrupts */ |
82 | uint RIOIntCount; /* # of intr since last check */ | 82 | uint RIOIntCount; /* # of intr since last check */ |
83 | uint RIOTxCount; /* number of xmit intrs */ | 83 | uint RIOTxCount; /* number of xmit intrs */ |
84 | uint RIORxCount; /* number of rx intrs */ | 84 | uint RIORxCount; /* number of rx intrs */ |
85 | uint RIORupCount; /* number of rup intrs */ | 85 | uint RIORupCount; /* number of rup intrs */ |
86 | int RIXTimer; | 86 | int RIXTimer; |
87 | int RIOBufferSize; /* Buffersize */ | 87 | int RIOBufferSize; /* Buffersize */ |
88 | int RIOBufferMask; /* Buffersize */ | 88 | int RIOBufferMask; /* Buffersize */ |
89 | 89 | ||
90 | int RIOFirstMajor; /* First host card's major no */ | 90 | int RIOFirstMajor; /* First host card's major no */ |
91 | 91 | ||
92 | uint RIOLastPortsMapped; /* highest port number known */ | 92 | uint RIOLastPortsMapped; /* highest port number known */ |
93 | uint RIOFirstPortsMapped; /* lowest port number known */ | 93 | uint RIOFirstPortsMapped; /* lowest port number known */ |
94 | 94 | ||
95 | uint RIOLastPortsBooted; /* highest port number running */ | 95 | uint RIOLastPortsBooted; /* highest port number running */ |
96 | uint RIOFirstPortsBooted; /* lowest port number running */ | 96 | uint RIOFirstPortsBooted; /* lowest port number running */ |
97 | 97 | ||
98 | uint RIOLastPortsOpened; /* highest port number running */ | 98 | uint RIOLastPortsOpened; /* highest port number running */ |
99 | uint RIOFirstPortsOpened; /* lowest port number running */ | 99 | uint RIOFirstPortsOpened; /* lowest port number running */ |
100 | 100 | ||
101 | /* Flag to say that the topology information has been changed. */ | 101 | /* Flag to say that the topology information has been changed. */ |
102 | uint RIOQuickCheck; | 102 | uint RIOQuickCheck; |
103 | uint CdRegister; /* ??? */ | 103 | uint CdRegister; /* ??? */ |
104 | int RIOSignalProcess; /* Signalling process */ | 104 | int RIOSignalProcess; /* Signalling process */ |
105 | int rio_debug; /* To debug ... */ | 105 | int rio_debug; /* To debug ... */ |
106 | int RIODebugWait; /* For what ??? */ | 106 | int RIODebugWait; /* For what ??? */ |
107 | int tpri; /* Thread prio */ | 107 | int tpri; /* Thread prio */ |
108 | int tid; /* Thread id */ | 108 | int tid; /* Thread id */ |
109 | uint _RIO_Polled; /* Counter for polling */ | 109 | uint _RIO_Polled; /* Counter for polling */ |
110 | uint _RIO_Interrupted; /* Counter for interrupt */ | 110 | uint _RIO_Interrupted; /* Counter for interrupt */ |
111 | int intr_tid; /* iointset return value */ | 111 | int intr_tid; /* iointset return value */ |
112 | int TxEnSem; /* TxEnable Semaphore */ | 112 | int TxEnSem; /* TxEnable Semaphore */ |
113 | 113 | ||
114 | 114 | ||
115 | struct Error RIOError; /* to Identify what went wrong */ | 115 | struct Error RIOError; /* to Identify what went wrong */ |
116 | struct Conf RIOConf; /* Configuration ??? */ | 116 | struct Conf RIOConf; /* Configuration ??? */ |
117 | struct ttystatics channel[RIO_PORTS]; /* channel information */ | 117 | struct ttystatics channel[RIO_PORTS]; /* channel information */ |
118 | char RIOBootPackets[1+(SIXTY_FOUR_K/RTA_BOOT_DATA_SIZE)] | 118 | char RIOBootPackets[1 + (SIXTY_FOUR_K / RTA_BOOT_DATA_SIZE)] |
119 | [RTA_BOOT_DATA_SIZE]; | 119 | [RTA_BOOT_DATA_SIZE]; |
120 | struct Map RIOConnectTable[TOTAL_MAP_ENTRIES]; | 120 | struct Map RIOConnectTable[TOTAL_MAP_ENTRIES]; |
121 | struct Map RIOSavedTable[TOTAL_MAP_ENTRIES]; | 121 | struct Map RIOSavedTable[TOTAL_MAP_ENTRIES]; |
122 | 122 | ||
123 | /* RTA to host binding table for master/slave operation */ | 123 | /* RTA to host binding table for master/slave operation */ |
124 | ulong RIOBindTab[MAX_RTA_BINDINGS]; | 124 | ulong RIOBindTab[MAX_RTA_BINDINGS]; |
125 | /* RTA memory dump variable */ | 125 | /* RTA memory dump variable */ |
126 | uchar RIOMemDump[MEMDUMP_SIZE]; | 126 | uchar RIOMemDump[MEMDUMP_SIZE]; |
127 | struct ModuleInfo RIOModuleTypes[MAX_MODULE_TYPES]; | 127 | struct ModuleInfo RIOModuleTypes[MAX_MODULE_TYPES]; |
128 | 128 | ||
129 | }; | 129 | }; |
130 | 130 | ||
@@ -141,4 +141,4 @@ struct rio_info { | |||
141 | #define WRBYTE(x,y) *(volatile unsigned char *)((x)) = \ | 141 | #define WRBYTE(x,y) *(volatile unsigned char *)((x)) = \ |
142 | (unsigned char)(y) | 142 | (unsigned char)(y) |
143 | 143 | ||
144 | #endif /* __riodrvr.h */ | 144 | #endif /* __riodrvr.h */ |
diff --git a/drivers/char/rio/rioinfo.h b/drivers/char/rio/rioinfo.h index e08421c9558e..8de7966e603a 100644 --- a/drivers/char/rio/rioinfo.h +++ b/drivers/char/rio/rioinfo.h | |||
@@ -41,29 +41,29 @@ static char *_rioinfo_h_sccs_ = "@(#)rioinfo.h 1.2"; | |||
41 | ** Host card data structure | 41 | ** Host card data structure |
42 | */ | 42 | */ |
43 | struct RioHostInfo { | 43 | struct RioHostInfo { |
44 | long location; /* RIO Card Base I/O address */ | 44 | long location; /* RIO Card Base I/O address */ |
45 | long vector; /* RIO Card IRQ vector */ | 45 | long vector; /* RIO Card IRQ vector */ |
46 | int bus; /* ISA/EISA/MCA/PCI */ | 46 | int bus; /* ISA/EISA/MCA/PCI */ |
47 | int mode; /* pointer to host mode - INTERRUPT / POLLED */ | 47 | int mode; /* pointer to host mode - INTERRUPT / POLLED */ |
48 | struct old_sgttyb | 48 | struct old_sgttyb |
49 | * Sg; /* pointer to default term characteristics */ | 49 | *Sg; /* pointer to default term characteristics */ |
50 | }; | 50 | }; |
51 | 51 | ||
52 | 52 | ||
53 | /* Mode in rio device info */ | 53 | /* Mode in rio device info */ |
54 | #define INTERRUPTED_MODE 0x01 /* Interrupt is generated */ | 54 | #define INTERRUPTED_MODE 0x01 /* Interrupt is generated */ |
55 | #define POLLED_MODE 0x02 /* No interrupt */ | 55 | #define POLLED_MODE 0x02 /* No interrupt */ |
56 | #define AUTO_MODE 0x03 /* Auto mode */ | 56 | #define AUTO_MODE 0x03 /* Auto mode */ |
57 | 57 | ||
58 | #define WORD_ACCESS_MODE 0x10 /* Word Access Mode */ | 58 | #define WORD_ACCESS_MODE 0x10 /* Word Access Mode */ |
59 | #define BYTE_ACCESS_MODE 0x20 /* Byte Access Mode */ | 59 | #define BYTE_ACCESS_MODE 0x20 /* Byte Access Mode */ |
60 | 60 | ||
61 | 61 | ||
62 | /* Bus type that RIO supports */ | 62 | /* Bus type that RIO supports */ |
63 | #define ISA_BUS 0x01 /* The card is ISA */ | 63 | #define ISA_BUS 0x01 /* The card is ISA */ |
64 | #define EISA_BUS 0x02 /* The card is EISA */ | 64 | #define EISA_BUS 0x02 /* The card is EISA */ |
65 | #define MCA_BUS 0x04 /* The card is MCA */ | 65 | #define MCA_BUS 0x04 /* The card is MCA */ |
66 | #define PCI_BUS 0x08 /* The card is PCI */ | 66 | #define PCI_BUS 0x08 /* The card is PCI */ |
67 | 67 | ||
68 | /* | 68 | /* |
69 | ** 11.11.1998 ARG - ESIL ???? part fix | 69 | ** 11.11.1998 ARG - ESIL ???? part fix |
@@ -93,4 +93,4 @@ struct RioHostInfo { | |||
93 | 'V' - '@' /* literal next char */ \ | 93 | 'V' - '@' /* literal next char */ \ |
94 | } | 94 | } |
95 | 95 | ||
96 | #endif /* __rioinfo_h */ | 96 | #endif /* __rioinfo_h */ |
diff --git a/drivers/char/rio/riointr.c b/drivers/char/rio/riointr.c index ddda9c14e059..34d8787557a1 100644 --- a/drivers/char/rio/riointr.c +++ b/drivers/char/rio/riointr.c | |||
@@ -88,99 +88,93 @@ static char *_riointr_c_sccs_ = "@(#)riointr.c 1.2"; | |||
88 | static void RIOReceive(struct rio_info *, struct Port *); | 88 | static void RIOReceive(struct rio_info *, struct Port *); |
89 | 89 | ||
90 | 90 | ||
91 | static char *firstchars (char *p, int nch) | 91 | static char *firstchars(char *p, int nch) |
92 | { | 92 | { |
93 | static char buf[2][128]; | 93 | static char buf[2][128]; |
94 | static int t=0; | 94 | static int t = 0; |
95 | t = ! t; | 95 | t = !t; |
96 | memcpy (buf[t], p, nch); | 96 | memcpy(buf[t], p, nch); |
97 | buf[t][nch] = 0; | 97 | buf[t][nch] = 0; |
98 | return buf[t]; | 98 | return buf[t]; |
99 | } | 99 | } |
100 | 100 | ||
101 | 101 | ||
102 | #define INCR( P, I ) ((P) = (((P)+(I)) & p->RIOBufferMask)) | 102 | #define INCR( P, I ) ((P) = (((P)+(I)) & p->RIOBufferMask)) |
103 | /* Enable and start the transmission of packets */ | 103 | /* Enable and start the transmission of packets */ |
104 | void | 104 | void RIOTxEnable(en) |
105 | RIOTxEnable(en) | 105 | char *en; |
106 | char * en; | ||
107 | { | 106 | { |
108 | struct Port * PortP; | 107 | struct Port *PortP; |
109 | struct rio_info *p; | 108 | struct rio_info *p; |
110 | struct tty_struct* tty; | 109 | struct tty_struct *tty; |
111 | int c; | 110 | int c; |
112 | struct PKT * PacketP; | 111 | struct PKT *PacketP; |
113 | unsigned long flags; | 112 | unsigned long flags; |
114 | 113 | ||
115 | PortP = (struct Port *)en; | 114 | PortP = (struct Port *) en; |
116 | p = (struct rio_info *)PortP->p; | 115 | p = (struct rio_info *) PortP->p; |
117 | tty = PortP->gs.tty; | 116 | tty = PortP->gs.tty; |
118 | 117 | ||
119 | 118 | ||
120 | rio_dprintk (RIO_DEBUG_INTR, "tx port %d: %d chars queued.\n", | 119 | rio_dprintk(RIO_DEBUG_INTR, "tx port %d: %d chars queued.\n", PortP->PortNum, PortP->gs.xmit_cnt); |
121 | PortP->PortNum, PortP->gs.xmit_cnt); | 120 | |
122 | 121 | if (!PortP->gs.xmit_cnt) | |
123 | if (!PortP->gs.xmit_cnt) return; | 122 | return; |
124 | 123 | ||
125 | 124 | ||
126 | /* This routine is an order of magnitude simpler than the specialix | 125 | /* This routine is an order of magnitude simpler than the specialix |
127 | version. One of the disadvantages is that this version will send | 126 | version. One of the disadvantages is that this version will send |
128 | an incomplete packet (usually 64 bytes instead of 72) once for | 127 | an incomplete packet (usually 64 bytes instead of 72) once for |
129 | every 4k worth of data. Let's just say that this won't influence | 128 | every 4k worth of data. Let's just say that this won't influence |
130 | performance significantly..... */ | 129 | performance significantly..... */ |
131 | 130 | ||
132 | rio_spin_lock_irqsave(&PortP->portSem, flags); | 131 | rio_spin_lock_irqsave(&PortP->portSem, flags); |
133 | 132 | ||
134 | while (can_add_transmit( &PacketP, PortP )) { | 133 | while (can_add_transmit(&PacketP, PortP)) { |
135 | c = PortP->gs.xmit_cnt; | 134 | c = PortP->gs.xmit_cnt; |
136 | if (c > PKT_MAX_DATA_LEN) c = PKT_MAX_DATA_LEN; | 135 | if (c > PKT_MAX_DATA_LEN) |
137 | 136 | c = PKT_MAX_DATA_LEN; | |
138 | /* Don't copy past the end of the source buffer */ | 137 | |
139 | if (c > SERIAL_XMIT_SIZE - PortP->gs.xmit_tail) | 138 | /* Don't copy past the end of the source buffer */ |
140 | c = SERIAL_XMIT_SIZE - PortP->gs.xmit_tail; | 139 | if (c > SERIAL_XMIT_SIZE - PortP->gs.xmit_tail) |
141 | 140 | c = SERIAL_XMIT_SIZE - PortP->gs.xmit_tail; | |
142 | { int t; | 141 | |
143 | t = (c > 10)?10:c; | 142 | { |
144 | 143 | int t; | |
145 | rio_dprintk (RIO_DEBUG_INTR, "rio: tx port %d: copying %d chars: %s - %s\n", | 144 | t = (c > 10) ? 10 : c; |
146 | PortP->PortNum, c, | 145 | |
147 | firstchars (PortP->gs.xmit_buf + PortP->gs.xmit_tail , t), | 146 | 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)); |
148 | firstchars (PortP->gs.xmit_buf + PortP->gs.xmit_tail + c-t, t)); | 147 | } |
149 | } | 148 | /* If for one reason or another, we can't copy more data, |
150 | /* If for one reason or another, we can't copy more data, | 149 | we're done! */ |
151 | we're done! */ | 150 | if (c == 0) |
152 | if (c == 0) break; | 151 | break; |
153 | 152 | ||
154 | rio_memcpy_toio (PortP->HostP->Caddr, (caddr_t)PacketP->data, | 153 | rio_memcpy_toio(PortP->HostP->Caddr, (caddr_t) PacketP->data, PortP->gs.xmit_buf + PortP->gs.xmit_tail, c); |
155 | PortP->gs.xmit_buf + PortP->gs.xmit_tail, c); | 154 | /* udelay (1); */ |
156 | /* udelay (1); */ | 155 | |
157 | 156 | writeb(c, &(PacketP->len)); | |
158 | writeb (c, &(PacketP->len)); | 157 | if (!(PortP->State & RIO_DELETED)) { |
159 | if (!( PortP->State & RIO_DELETED ) ) { | 158 | add_transmit(PortP); |
160 | add_transmit ( PortP ); | 159 | /* |
161 | /* | 160 | ** Count chars tx'd for port statistics reporting |
162 | ** Count chars tx'd for port statistics reporting | 161 | */ |
163 | */ | 162 | if (PortP->statsGather) |
164 | if ( PortP->statsGather ) | 163 | PortP->txchars += c; |
165 | PortP->txchars += c; | 164 | } |
166 | } | 165 | PortP->gs.xmit_tail = (PortP->gs.xmit_tail + c) & (SERIAL_XMIT_SIZE - 1); |
167 | PortP->gs.xmit_tail = (PortP->gs.xmit_tail + c) & (SERIAL_XMIT_SIZE-1); | 166 | PortP->gs.xmit_cnt -= c; |
168 | PortP->gs.xmit_cnt -= c; | 167 | } |
169 | } | 168 | |
170 | 169 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | |
171 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | 170 | |
172 | 171 | if (PortP->gs.xmit_cnt <= (PortP->gs.wakeup_chars + 2 * PKT_MAX_DATA_LEN)) { | |
173 | if (PortP->gs.xmit_cnt <= (PortP->gs.wakeup_chars + 2*PKT_MAX_DATA_LEN)) { | 172 | rio_dprintk(RIO_DEBUG_INTR, "Waking up.... ldisc:%d (%d/%d)....", (int) (PortP->gs.tty->flags & (1 << TTY_DO_WRITE_WAKEUP)), PortP->gs.wakeup_chars, PortP->gs.xmit_cnt); |
174 | rio_dprintk (RIO_DEBUG_INTR, "Waking up.... ldisc:%d (%d/%d)....", | 173 | if ((PortP->gs.tty->flags & (1 << TTY_DO_WRITE_WAKEUP)) && PortP->gs.tty->ldisc.write_wakeup) |
175 | (int)(PortP->gs.tty->flags & (1 << TTY_DO_WRITE_WAKEUP)), | 174 | (PortP->gs.tty->ldisc.write_wakeup) (PortP->gs.tty); |
176 | PortP->gs.wakeup_chars, PortP->gs.xmit_cnt); | 175 | rio_dprintk(RIO_DEBUG_INTR, "(%d/%d)\n", PortP->gs.wakeup_chars, PortP->gs.xmit_cnt); |
177 | if ((PortP->gs.tty->flags & (1 << TTY_DO_WRITE_WAKEUP)) && | 176 | wake_up_interruptible(&PortP->gs.tty->write_wait); |
178 | PortP->gs.tty->ldisc.write_wakeup) | 177 | } |
179 | (PortP->gs.tty->ldisc.write_wakeup)(PortP->gs.tty); | ||
180 | rio_dprintk (RIO_DEBUG_INTR, "(%d/%d)\n", | ||
181 | PortP->gs.wakeup_chars, PortP->gs.xmit_cnt); | ||
182 | wake_up_interruptible(&PortP->gs.tty->write_wait); | ||
183 | } | ||
184 | 178 | ||
185 | } | 179 | } |
186 | 180 | ||
@@ -189,361 +183,349 @@ char * en; | |||
189 | ** RIO Host Service routine. Does all the work traditionally associated with an | 183 | ** RIO Host Service routine. Does all the work traditionally associated with an |
190 | ** interrupt. | 184 | ** interrupt. |
191 | */ | 185 | */ |
192 | static int RupIntr; | 186 | static int RupIntr; |
193 | static int RxIntr; | 187 | static int RxIntr; |
194 | static int TxIntr; | 188 | static int TxIntr; |
195 | void | 189 | void RIOServiceHost(p, HostP, From) |
196 | RIOServiceHost(p, HostP, From) | 190 | struct rio_info *p; |
197 | struct rio_info * p; | ||
198 | struct Host *HostP; | 191 | struct Host *HostP; |
199 | int From; | 192 | int From; |
200 | { | 193 | { |
201 | rio_spin_lock (&HostP->HostLock); | 194 | rio_spin_lock(&HostP->HostLock); |
202 | if ( (HostP->Flags & RUN_STATE) != RC_RUNNING ) { | 195 | if ((HostP->Flags & RUN_STATE) != RC_RUNNING) { |
203 | static int t =0; | 196 | static int t = 0; |
204 | rio_spin_unlock (&HostP->HostLock); | 197 | rio_spin_unlock(&HostP->HostLock); |
205 | if ((t++ % 200) == 0) | 198 | if ((t++ % 200) == 0) |
206 | rio_dprintk (RIO_DEBUG_INTR, "Interrupt but host not running. flags=%x.\n", (int)HostP->Flags); | 199 | rio_dprintk(RIO_DEBUG_INTR, "Interrupt but host not running. flags=%x.\n", (int) HostP->Flags); |
207 | return; | 200 | return; |
208 | } | 201 | } |
209 | rio_spin_unlock (&HostP->HostLock); | 202 | rio_spin_unlock(&HostP->HostLock); |
210 | 203 | ||
211 | if ( RWORD( HostP->ParmMapP->rup_intr ) ) { | 204 | if (RWORD(HostP->ParmMapP->rup_intr)) { |
212 | WWORD( HostP->ParmMapP->rup_intr , 0 ); | 205 | WWORD(HostP->ParmMapP->rup_intr, 0); |
213 | p->RIORupCount++; | 206 | p->RIORupCount++; |
214 | RupIntr++; | 207 | RupIntr++; |
215 | rio_dprintk (RIO_DEBUG_INTR, "rio: RUP interrupt on host %d\n", HostP-p->RIOHosts); | 208 | rio_dprintk(RIO_DEBUG_INTR, "rio: RUP interrupt on host %d\n", HostP - p->RIOHosts); |
216 | RIOPollHostCommands(p, HostP ); | 209 | RIOPollHostCommands(p, HostP); |
217 | } | 210 | } |
218 | 211 | ||
219 | if ( RWORD( HostP->ParmMapP->rx_intr ) ) { | 212 | if (RWORD(HostP->ParmMapP->rx_intr)) { |
220 | int port; | 213 | int port; |
221 | 214 | ||
222 | WWORD( HostP->ParmMapP->rx_intr , 0 ); | 215 | WWORD(HostP->ParmMapP->rx_intr, 0); |
223 | p->RIORxCount++; | 216 | p->RIORxCount++; |
224 | RxIntr++; | 217 | RxIntr++; |
225 | 218 | ||
226 | rio_dprintk (RIO_DEBUG_INTR, "rio: RX interrupt on host %d\n", HostP-p->RIOHosts); | 219 | rio_dprintk(RIO_DEBUG_INTR, "rio: RX interrupt on host %d\n", HostP - p->RIOHosts); |
227 | /* | 220 | /* |
228 | ** Loop through every port. If the port is mapped into | 221 | ** Loop through every port. If the port is mapped into |
229 | ** the system ( i.e. has /dev/ttyXXXX associated ) then it is | 222 | ** the system ( i.e. has /dev/ttyXXXX associated ) then it is |
230 | ** worth checking. If the port isn't open, grab any packets | 223 | ** worth checking. If the port isn't open, grab any packets |
231 | ** hanging on its receive queue and stuff them on the free | 224 | ** hanging on its receive queue and stuff them on the free |
232 | ** list; check for commands on the way. | 225 | ** list; check for commands on the way. |
233 | */ | 226 | */ |
234 | for ( port=p->RIOFirstPortsBooted; | 227 | for (port = p->RIOFirstPortsBooted; port < p->RIOLastPortsBooted + PORTS_PER_RTA; port++) { |
235 | port<p->RIOLastPortsBooted+PORTS_PER_RTA; port++ ) { | 228 | struct Port *PortP = p->RIOPortp[port]; |
236 | struct Port *PortP = p->RIOPortp[port]; | 229 | struct tty_struct *ttyP; |
237 | struct tty_struct *ttyP; | 230 | struct PKT *PacketP; |
238 | struct PKT *PacketP; | 231 | |
239 | 232 | /* | |
240 | /* | 233 | ** not mapped in - most of the RIOPortp[] information |
241 | ** not mapped in - most of the RIOPortp[] information | 234 | ** has not been set up! |
242 | ** has not been set up! | 235 | ** Optimise: ports come in bundles of eight. |
243 | ** Optimise: ports come in bundles of eight. | 236 | */ |
244 | */ | 237 | if (!PortP->Mapped) { |
245 | if ( !PortP->Mapped ) { | 238 | port += 7; |
246 | port += 7; | 239 | continue; /* with the next port */ |
247 | continue; /* with the next port */ | 240 | } |
248 | } | 241 | |
249 | 242 | /* | |
250 | /* | 243 | ** If the host board isn't THIS host board, check the next one. |
251 | ** If the host board isn't THIS host board, check the next one. | 244 | ** optimise: ports come in bundles of eight. |
252 | ** optimise: ports come in bundles of eight. | 245 | */ |
253 | */ | 246 | if (PortP->HostP != HostP) { |
254 | if ( PortP->HostP != HostP ) { | 247 | port += 7; |
255 | port += 7; | 248 | continue; |
256 | continue; | 249 | } |
257 | } | 250 | |
258 | 251 | /* | |
259 | /* | 252 | ** Let us see - is the port open? If not, then don't service it. |
260 | ** Let us see - is the port open? If not, then don't service it. | 253 | */ |
261 | */ | 254 | if (!(PortP->PortState & PORT_ISOPEN)) { |
262 | if ( !( PortP->PortState & PORT_ISOPEN ) ) { | 255 | continue; |
263 | continue; | 256 | } |
264 | } | 257 | |
265 | 258 | /* | |
266 | /* | 259 | ** find corresponding tty structure. The process of mapping |
267 | ** find corresponding tty structure. The process of mapping | 260 | ** the ports puts these here. |
268 | ** the ports puts these here. | 261 | */ |
269 | */ | 262 | ttyP = PortP->gs.tty; |
270 | ttyP = PortP->gs.tty; | 263 | |
271 | 264 | /* | |
272 | /* | 265 | ** Lock the port before we begin working on it. |
273 | ** Lock the port before we begin working on it. | 266 | */ |
274 | */ | 267 | rio_spin_lock(&PortP->portSem); |
275 | rio_spin_lock(&PortP->portSem); | 268 | |
276 | 269 | /* | |
277 | /* | 270 | ** Process received data if there is any. |
278 | ** Process received data if there is any. | 271 | */ |
279 | */ | 272 | if (can_remove_receive(&PacketP, PortP)) |
280 | if ( can_remove_receive( &PacketP, PortP ) ) | 273 | RIOReceive(p, PortP); |
281 | RIOReceive(p, PortP); | 274 | |
282 | 275 | /* | |
283 | /* | 276 | ** If there is no data left to be read from the port, and |
284 | ** If there is no data left to be read from the port, and | 277 | ** it's handshake bit is set, then we must clear the handshake, |
285 | ** it's handshake bit is set, then we must clear the handshake, | 278 | ** so that that downstream RTA is re-enabled. |
286 | ** so that that downstream RTA is re-enabled. | 279 | */ |
287 | */ | 280 | if (!can_remove_receive(&PacketP, PortP) && (RWORD(PortP->PhbP->handshake) == PHB_HANDSHAKE_SET)) { |
288 | if ( !can_remove_receive( &PacketP, PortP ) && | ||
289 | ( RWORD( PortP->PhbP->handshake )==PHB_HANDSHAKE_SET ) ) { | ||
290 | /* | 281 | /* |
291 | ** MAGIC! ( Basically, handshake the RX buffer, so that | 282 | ** MAGIC! ( Basically, handshake the RX buffer, so that |
292 | ** the RTAs upstream can be re-enabled. ) | 283 | ** the RTAs upstream can be re-enabled. ) |
293 | */ | 284 | */ |
294 | rio_dprintk (RIO_DEBUG_INTR, "Set RX handshake bit\n"); | 285 | rio_dprintk(RIO_DEBUG_INTR, "Set RX handshake bit\n"); |
295 | WWORD( PortP->PhbP->handshake, | 286 | WWORD(PortP->PhbP->handshake, PHB_HANDSHAKE_SET | PHB_HANDSHAKE_RESET); |
296 | PHB_HANDSHAKE_SET|PHB_HANDSHAKE_RESET ); | 287 | } |
297 | } | 288 | rio_spin_unlock(&PortP->portSem); |
298 | rio_spin_unlock(&PortP->portSem); | 289 | } |
299 | } | ||
300 | } | ||
301 | |||
302 | if ( RWORD( HostP->ParmMapP->tx_intr ) ) { | ||
303 | int port; | ||
304 | |||
305 | WWORD( HostP->ParmMapP->tx_intr , 0); | ||
306 | |||
307 | p->RIOTxCount++; | ||
308 | TxIntr++; | ||
309 | rio_dprintk (RIO_DEBUG_INTR, "rio: TX interrupt on host %d\n", HostP-p->RIOHosts); | ||
310 | |||
311 | /* | ||
312 | ** Loop through every port. | ||
313 | ** If the port is mapped into the system ( i.e. has /dev/ttyXXXX | ||
314 | ** associated ) then it is worth checking. | ||
315 | */ | ||
316 | for ( port=p->RIOFirstPortsBooted; | ||
317 | port<p->RIOLastPortsBooted+PORTS_PER_RTA; port++ ) { | ||
318 | struct Port *PortP = p->RIOPortp[port]; | ||
319 | struct tty_struct *ttyP; | ||
320 | struct PKT *PacketP; | ||
321 | |||
322 | /* | ||
323 | ** not mapped in - most of the RIOPortp[] information | ||
324 | ** has not been set up! | ||
325 | */ | ||
326 | if ( !PortP->Mapped ) { | ||
327 | port += 7; | ||
328 | continue; /* with the next port */ | ||
329 | } | ||
330 | |||
331 | /* | ||
332 | ** If the host board isn't running, then its data structures | ||
333 | ** are no use to us - continue quietly. | ||
334 | */ | ||
335 | if ( PortP->HostP != HostP ) { | ||
336 | port += 7; | ||
337 | continue; /* with the next port */ | ||
338 | } | ||
339 | |||
340 | /* | ||
341 | ** Let us see - is the port open? If not, then don't service it. | ||
342 | */ | ||
343 | if ( !( PortP->PortState & PORT_ISOPEN ) ) { | ||
344 | continue; | ||
345 | } | ||
346 | |||
347 | rio_dprintk (RIO_DEBUG_INTR, "rio: Looking into port %d.\n", port); | ||
348 | /* | ||
349 | ** Lock the port before we begin working on it. | ||
350 | */ | ||
351 | rio_spin_lock(&PortP->portSem); | ||
352 | |||
353 | /* | ||
354 | ** If we can't add anything to the transmit queue, then | ||
355 | ** we need do none of this processing. | ||
356 | */ | ||
357 | if ( !can_add_transmit( &PacketP, PortP ) ) { | ||
358 | rio_dprintk (RIO_DEBUG_INTR, "Can't add to port, so skipping.\n"); | ||
359 | rio_spin_unlock(&PortP->portSem); | ||
360 | continue; | ||
361 | } | ||
362 | |||
363 | /* | ||
364 | ** find corresponding tty structure. The process of mapping | ||
365 | ** the ports puts these here. | ||
366 | */ | ||
367 | ttyP = PortP->gs.tty; | ||
368 | /* If ttyP is NULL, the port is getting closed. Forget about it. */ | ||
369 | if (!ttyP) { | ||
370 | rio_dprintk (RIO_DEBUG_INTR, "no tty, so skipping.\n"); | ||
371 | rio_spin_unlock(&PortP->portSem); | ||
372 | continue; | ||
373 | } | ||
374 | /* | ||
375 | ** If there is more room available we start up the transmit | ||
376 | ** data process again. This can be direct I/O, if the cookmode | ||
377 | ** is set to COOK_RAW or COOK_MEDIUM, or will be a call to the | ||
378 | ** riotproc( T_OUTPUT ) if we are in COOK_WELL mode, to fetch | ||
379 | ** characters via the line discipline. We must always call | ||
380 | ** the line discipline, | ||
381 | ** so that user input characters can be echoed correctly. | ||
382 | ** | ||
383 | ** ++++ Update +++++ | ||
384 | ** With the advent of double buffering, we now see if | ||
385 | ** TxBufferOut-In is non-zero. If so, then we copy a packet | ||
386 | ** to the output place, and set it going. If this empties | ||
387 | ** the buffer, then we must issue a wakeup( ) on OUT. | ||
388 | ** If it frees space in the buffer then we must issue | ||
389 | ** a wakeup( ) on IN. | ||
390 | ** | ||
391 | ** ++++ Extra! Extra! If PortP->WflushFlag is set, then we | ||
392 | ** have to send a WFLUSH command down the PHB, to mark the | ||
393 | ** end point of a WFLUSH. We also need to clear out any | ||
394 | ** data from the double buffer! ( note that WflushFlag is a | ||
395 | ** *count* of the number of WFLUSH commands outstanding! ) | ||
396 | ** | ||
397 | ** ++++ And there's more! | ||
398 | ** If an RTA is powered off, then on again, and rebooted, | ||
399 | ** whilst it has ports open, then we need to re-open the ports. | ||
400 | ** ( reasonable enough ). We can't do this when we spot the | ||
401 | ** re-boot, in interrupt time, because the queue is probably | ||
402 | ** full. So, when we come in here, we need to test if any | ||
403 | ** ports are in this condition, and re-open the port before | ||
404 | ** we try to send any more data to it. Now, the re-booted | ||
405 | ** RTA will be discarding packets from the PHB until it | ||
406 | ** receives this open packet, but don't worry tooo much | ||
407 | ** about that. The one thing that is interesting is the | ||
408 | ** combination of this effect and the WFLUSH effect! | ||
409 | */ | ||
410 | /* For now don't handle RTA reboots. -- REW. | ||
411 | Reenabled. Otherwise RTA reboots didn't work. Duh. -- REW */ | ||
412 | if ( PortP->MagicFlags ) { | ||
413 | #if 1 | ||
414 | if ( PortP->MagicFlags & MAGIC_REBOOT ) { | ||
415 | /* | ||
416 | ** well, the RTA has been rebooted, and there is room | ||
417 | ** on its queue to add the open packet that is required. | ||
418 | ** | ||
419 | ** The messy part of this line is trying to decide if | ||
420 | ** we need to call the Param function as a tty or as | ||
421 | ** a modem. | ||
422 | ** DONT USE CLOCAL AS A TEST FOR THIS! | ||
423 | ** | ||
424 | ** If we can't param the port, then move on to the | ||
425 | ** next port. | ||
426 | */ | ||
427 | PortP->InUse = NOT_INUSE; | ||
428 | |||
429 | rio_spin_unlock(&PortP->portSem); | ||
430 | if ( RIOParam(PortP, OPEN, ((PortP->Cor2Copy & | ||
431 | (COR2_RTSFLOW|COR2_CTSFLOW ) )== | ||
432 | (COR2_RTSFLOW|COR2_CTSFLOW ) ) ? | ||
433 | TRUE : FALSE, DONT_SLEEP ) == RIO_FAIL ) { | ||
434 | continue; /* with next port */ | ||
435 | } | ||
436 | rio_spin_lock(&PortP->portSem); | ||
437 | PortP->MagicFlags &= ~MAGIC_REBOOT; | ||
438 | } | 290 | } |
291 | |||
292 | if (RWORD(HostP->ParmMapP->tx_intr)) { | ||
293 | int port; | ||
294 | |||
295 | WWORD(HostP->ParmMapP->tx_intr, 0); | ||
296 | |||
297 | p->RIOTxCount++; | ||
298 | TxIntr++; | ||
299 | rio_dprintk(RIO_DEBUG_INTR, "rio: TX interrupt on host %d\n", HostP - p->RIOHosts); | ||
300 | |||
301 | /* | ||
302 | ** Loop through every port. | ||
303 | ** If the port is mapped into the system ( i.e. has /dev/ttyXXXX | ||
304 | ** associated ) then it is worth checking. | ||
305 | */ | ||
306 | for (port = p->RIOFirstPortsBooted; port < p->RIOLastPortsBooted + PORTS_PER_RTA; port++) { | ||
307 | struct Port *PortP = p->RIOPortp[port]; | ||
308 | struct tty_struct *ttyP; | ||
309 | struct PKT *PacketP; | ||
310 | |||
311 | /* | ||
312 | ** not mapped in - most of the RIOPortp[] information | ||
313 | ** has not been set up! | ||
314 | */ | ||
315 | if (!PortP->Mapped) { | ||
316 | port += 7; | ||
317 | continue; /* with the next port */ | ||
318 | } | ||
319 | |||
320 | /* | ||
321 | ** If the host board isn't running, then its data structures | ||
322 | ** are no use to us - continue quietly. | ||
323 | */ | ||
324 | if (PortP->HostP != HostP) { | ||
325 | port += 7; | ||
326 | continue; /* with the next port */ | ||
327 | } | ||
328 | |||
329 | /* | ||
330 | ** Let us see - is the port open? If not, then don't service it. | ||
331 | */ | ||
332 | if (!(PortP->PortState & PORT_ISOPEN)) { | ||
333 | continue; | ||
334 | } | ||
335 | |||
336 | rio_dprintk(RIO_DEBUG_INTR, "rio: Looking into port %d.\n", port); | ||
337 | /* | ||
338 | ** Lock the port before we begin working on it. | ||
339 | */ | ||
340 | rio_spin_lock(&PortP->portSem); | ||
341 | |||
342 | /* | ||
343 | ** If we can't add anything to the transmit queue, then | ||
344 | ** we need do none of this processing. | ||
345 | */ | ||
346 | if (!can_add_transmit(&PacketP, PortP)) { | ||
347 | rio_dprintk(RIO_DEBUG_INTR, "Can't add to port, so skipping.\n"); | ||
348 | rio_spin_unlock(&PortP->portSem); | ||
349 | continue; | ||
350 | } | ||
351 | |||
352 | /* | ||
353 | ** find corresponding tty structure. The process of mapping | ||
354 | ** the ports puts these here. | ||
355 | */ | ||
356 | ttyP = PortP->gs.tty; | ||
357 | /* If ttyP is NULL, the port is getting closed. Forget about it. */ | ||
358 | if (!ttyP) { | ||
359 | rio_dprintk(RIO_DEBUG_INTR, "no tty, so skipping.\n"); | ||
360 | rio_spin_unlock(&PortP->portSem); | ||
361 | continue; | ||
362 | } | ||
363 | /* | ||
364 | ** If there is more room available we start up the transmit | ||
365 | ** data process again. This can be direct I/O, if the cookmode | ||
366 | ** is set to COOK_RAW or COOK_MEDIUM, or will be a call to the | ||
367 | ** riotproc( T_OUTPUT ) if we are in COOK_WELL mode, to fetch | ||
368 | ** characters via the line discipline. We must always call | ||
369 | ** the line discipline, | ||
370 | ** so that user input characters can be echoed correctly. | ||
371 | ** | ||
372 | ** ++++ Update +++++ | ||
373 | ** With the advent of double buffering, we now see if | ||
374 | ** TxBufferOut-In is non-zero. If so, then we copy a packet | ||
375 | ** to the output place, and set it going. If this empties | ||
376 | ** the buffer, then we must issue a wakeup( ) on OUT. | ||
377 | ** If it frees space in the buffer then we must issue | ||
378 | ** a wakeup( ) on IN. | ||
379 | ** | ||
380 | ** ++++ Extra! Extra! If PortP->WflushFlag is set, then we | ||
381 | ** have to send a WFLUSH command down the PHB, to mark the | ||
382 | ** end point of a WFLUSH. We also need to clear out any | ||
383 | ** data from the double buffer! ( note that WflushFlag is a | ||
384 | ** *count* of the number of WFLUSH commands outstanding! ) | ||
385 | ** | ||
386 | ** ++++ And there's more! | ||
387 | ** If an RTA is powered off, then on again, and rebooted, | ||
388 | ** whilst it has ports open, then we need to re-open the ports. | ||
389 | ** ( reasonable enough ). We can't do this when we spot the | ||
390 | ** re-boot, in interrupt time, because the queue is probably | ||
391 | ** full. So, when we come in here, we need to test if any | ||
392 | ** ports are in this condition, and re-open the port before | ||
393 | ** we try to send any more data to it. Now, the re-booted | ||
394 | ** RTA will be discarding packets from the PHB until it | ||
395 | ** receives this open packet, but don't worry tooo much | ||
396 | ** about that. The one thing that is interesting is the | ||
397 | ** combination of this effect and the WFLUSH effect! | ||
398 | */ | ||
399 | /* For now don't handle RTA reboots. -- REW. | ||
400 | Reenabled. Otherwise RTA reboots didn't work. Duh. -- REW */ | ||
401 | if (PortP->MagicFlags) { | ||
402 | #if 1 | ||
403 | if (PortP->MagicFlags & MAGIC_REBOOT) { | ||
404 | /* | ||
405 | ** well, the RTA has been rebooted, and there is room | ||
406 | ** on its queue to add the open packet that is required. | ||
407 | ** | ||
408 | ** The messy part of this line is trying to decide if | ||
409 | ** we need to call the Param function as a tty or as | ||
410 | ** a modem. | ||
411 | ** DONT USE CLOCAL AS A TEST FOR THIS! | ||
412 | ** | ||
413 | ** If we can't param the port, then move on to the | ||
414 | ** next port. | ||
415 | */ | ||
416 | PortP->InUse = NOT_INUSE; | ||
417 | |||
418 | rio_spin_unlock(&PortP->portSem); | ||
419 | if (RIOParam(PortP, OPEN, ((PortP->Cor2Copy & (COR2_RTSFLOW | COR2_CTSFLOW)) == (COR2_RTSFLOW | COR2_CTSFLOW)) ? TRUE : FALSE, DONT_SLEEP) == RIO_FAIL) { | ||
420 | continue; /* with next port */ | ||
421 | } | ||
422 | rio_spin_lock(&PortP->portSem); | ||
423 | PortP->MagicFlags &= ~MAGIC_REBOOT; | ||
424 | } | ||
439 | #endif | 425 | #endif |
440 | 426 | ||
441 | /* | 427 | /* |
442 | ** As mentioned above, this is a tacky hack to cope | 428 | ** As mentioned above, this is a tacky hack to cope |
443 | ** with WFLUSH | 429 | ** with WFLUSH |
444 | */ | 430 | */ |
445 | if ( PortP->WflushFlag ) { | 431 | if (PortP->WflushFlag) { |
446 | rio_dprintk (RIO_DEBUG_INTR, "Want to WFLUSH mark this port\n"); | 432 | rio_dprintk(RIO_DEBUG_INTR, "Want to WFLUSH mark this port\n"); |
447 | 433 | ||
448 | if ( PortP->InUse ) | 434 | if (PortP->InUse) |
449 | rio_dprintk (RIO_DEBUG_INTR, "FAILS - PORT IS IN USE\n"); | 435 | rio_dprintk(RIO_DEBUG_INTR, "FAILS - PORT IS IN USE\n"); |
450 | } | 436 | } |
451 | 437 | ||
452 | while ( PortP->WflushFlag && | 438 | while (PortP->WflushFlag && can_add_transmit(&PacketP, PortP) && (PortP->InUse == NOT_INUSE)) { |
453 | can_add_transmit( &PacketP, PortP ) && | 439 | int p; |
454 | ( PortP->InUse == NOT_INUSE ) ) { | 440 | struct PktCmd *PktCmdP; |
455 | int p; | 441 | |
456 | struct PktCmd *PktCmdP; | 442 | rio_dprintk(RIO_DEBUG_INTR, "Add WFLUSH marker to data queue\n"); |
457 | 443 | /* | |
458 | rio_dprintk (RIO_DEBUG_INTR, "Add WFLUSH marker to data queue\n"); | 444 | ** make it look just like a WFLUSH command |
459 | /* | 445 | */ |
460 | ** make it look just like a WFLUSH command | 446 | PktCmdP = (struct PktCmd *) &PacketP->data[0]; |
461 | */ | 447 | |
462 | PktCmdP = ( struct PktCmd * )&PacketP->data[0]; | 448 | WBYTE(PktCmdP->Command, WFLUSH); |
463 | 449 | ||
464 | WBYTE( PktCmdP->Command , WFLUSH ); | 450 | p = PortP->HostPort % (ushort) PORTS_PER_RTA; |
465 | 451 | ||
466 | p = PortP->HostPort % ( ushort )PORTS_PER_RTA; | 452 | /* |
467 | 453 | ** If second block of ports for 16 port RTA, add 8 | |
468 | /* | 454 | ** to index 8-15. |
469 | ** If second block of ports for 16 port RTA, add 8 | 455 | */ |
470 | ** to index 8-15. | 456 | if (PortP->SecondBlock) |
471 | */ | 457 | p += PORTS_PER_RTA; |
472 | if ( PortP->SecondBlock ) | 458 | |
473 | p += PORTS_PER_RTA; | 459 | WBYTE(PktCmdP->PhbNum, p); |
474 | 460 | ||
475 | WBYTE( PktCmdP->PhbNum, p ); | 461 | /* |
476 | 462 | ** to make debuggery easier | |
477 | /* | 463 | */ |
478 | ** to make debuggery easier | 464 | WBYTE(PacketP->data[2], 'W'); |
479 | */ | 465 | WBYTE(PacketP->data[3], 'F'); |
480 | WBYTE( PacketP->data[ 2], 'W' ); | 466 | WBYTE(PacketP->data[4], 'L'); |
481 | WBYTE( PacketP->data[ 3], 'F' ); | 467 | WBYTE(PacketP->data[5], 'U'); |
482 | WBYTE( PacketP->data[ 4], 'L' ); | 468 | WBYTE(PacketP->data[6], 'S'); |
483 | WBYTE( PacketP->data[ 5], 'U' ); | 469 | WBYTE(PacketP->data[7], 'H'); |
484 | WBYTE( PacketP->data[ 6], 'S' ); | 470 | WBYTE(PacketP->data[8], ' '); |
485 | WBYTE( PacketP->data[ 7], 'H' ); | 471 | WBYTE(PacketP->data[9], '0' + PortP->WflushFlag); |
486 | WBYTE( PacketP->data[ 8], ' ' ); | 472 | WBYTE(PacketP->data[10], ' '); |
487 | WBYTE( PacketP->data[ 9], '0'+PortP->WflushFlag ); | 473 | WBYTE(PacketP->data[11], ' '); |
488 | WBYTE( PacketP->data[10], ' ' ); | 474 | WBYTE(PacketP->data[12], '\0'); |
489 | WBYTE( PacketP->data[11], ' ' ); | 475 | |
490 | WBYTE( PacketP->data[12], '\0' ); | 476 | /* |
491 | 477 | ** its two bytes long! | |
492 | /* | 478 | */ |
493 | ** its two bytes long! | 479 | WBYTE(PacketP->len, PKT_CMD_BIT | 2); |
494 | */ | 480 | |
495 | WBYTE( PacketP->len , PKT_CMD_BIT | 2 ); | 481 | /* |
496 | 482 | ** queue it! | |
497 | /* | 483 | */ |
498 | ** queue it! | 484 | if (!(PortP->State & RIO_DELETED)) { |
499 | */ | 485 | add_transmit(PortP); |
500 | if ( !( PortP->State & RIO_DELETED ) ) { | 486 | /* |
501 | add_transmit( PortP ); | 487 | ** Count chars tx'd for port statistics reporting |
502 | /* | 488 | */ |
503 | ** Count chars tx'd for port statistics reporting | 489 | if (PortP->statsGather) |
504 | */ | 490 | PortP->txchars += 2; |
505 | if ( PortP->statsGather ) | 491 | } |
506 | PortP->txchars += 2; | 492 | |
507 | } | 493 | if (--(PortP->WflushFlag) == 0) { |
508 | 494 | PortP->MagicFlags &= ~MAGIC_FLUSH; | |
509 | if ( --( PortP->WflushFlag ) == 0 ) { | 495 | } |
510 | PortP->MagicFlags &= ~MAGIC_FLUSH; | 496 | |
511 | } | 497 | rio_dprintk(RIO_DEBUG_INTR, "Wflush count now stands at %d\n", PortP->WflushFlag); |
512 | 498 | } | |
513 | rio_dprintk (RIO_DEBUG_INTR, "Wflush count now stands at %d\n", | 499 | if (PortP->MagicFlags & MORE_OUTPUT_EYGOR) { |
514 | PortP->WflushFlag); | 500 | if (PortP->MagicFlags & MAGIC_FLUSH) { |
515 | } | 501 | PortP->MagicFlags |= MORE_OUTPUT_EYGOR; |
516 | if ( PortP->MagicFlags & MORE_OUTPUT_EYGOR ) { | 502 | } else { |
517 | if ( PortP->MagicFlags & MAGIC_FLUSH ) { | 503 | if (!can_add_transmit(&PacketP, PortP)) { |
518 | PortP->MagicFlags |= MORE_OUTPUT_EYGOR; | 504 | rio_spin_unlock(&PortP->portSem); |
519 | } | 505 | continue; |
520 | else { | 506 | } |
521 | if ( !can_add_transmit( &PacketP, PortP ) ) { | 507 | rio_spin_unlock(&PortP->portSem); |
522 | rio_spin_unlock(&PortP->portSem); | 508 | RIOTxEnable((char *) PortP); |
523 | continue; | 509 | rio_spin_lock(&PortP->portSem); |
524 | } | 510 | PortP->MagicFlags &= ~MORE_OUTPUT_EYGOR; |
525 | rio_spin_unlock(&PortP->portSem); | 511 | } |
526 | RIOTxEnable((char *)PortP); | 512 | } |
527 | rio_spin_lock(&PortP->portSem); | 513 | } |
528 | PortP->MagicFlags &= ~MORE_OUTPUT_EYGOR; | 514 | |
529 | } | 515 | |
516 | /* | ||
517 | ** If we can't add anything to the transmit queue, then | ||
518 | ** we need do none of the remaining processing. | ||
519 | */ | ||
520 | if (!can_add_transmit(&PacketP, PortP)) { | ||
521 | rio_spin_unlock(&PortP->portSem); | ||
522 | continue; | ||
523 | } | ||
524 | |||
525 | rio_spin_unlock(&PortP->portSem); | ||
526 | RIOTxEnable((char *) PortP); | ||
527 | } | ||
530 | } | 528 | } |
531 | } | ||
532 | |||
533 | |||
534 | /* | ||
535 | ** If we can't add anything to the transmit queue, then | ||
536 | ** we need do none of the remaining processing. | ||
537 | */ | ||
538 | if (!can_add_transmit( &PacketP, PortP ) ) { | ||
539 | rio_spin_unlock(&PortP->portSem); | ||
540 | continue; | ||
541 | } | ||
542 | |||
543 | rio_spin_unlock(&PortP->portSem); | ||
544 | RIOTxEnable((char *)PortP); | ||
545 | } | ||
546 | } | ||
547 | } | 529 | } |
548 | 530 | ||
549 | /* | 531 | /* |
@@ -551,176 +533,162 @@ int From; | |||
551 | ** NB: Called with the tty locked. The spl from the lockb( ) is passed. | 533 | ** NB: Called with the tty locked. The spl from the lockb( ) is passed. |
552 | ** we return the ttySpl level that we re-locked at. | 534 | ** we return the ttySpl level that we re-locked at. |
553 | */ | 535 | */ |
554 | static void | 536 | static void RIOReceive(p, PortP) |
555 | RIOReceive(p, PortP) | 537 | struct rio_info *p; |
556 | struct rio_info * p; | 538 | struct Port *PortP; |
557 | struct Port * PortP; | ||
558 | { | 539 | { |
559 | struct tty_struct *TtyP; | 540 | struct tty_struct *TtyP; |
560 | register ushort transCount; | 541 | register ushort transCount; |
561 | struct PKT *PacketP; | 542 | struct PKT *PacketP; |
562 | register uint DataCnt; | 543 | register uint DataCnt; |
563 | uchar * ptr; | 544 | uchar *ptr; |
564 | unsigned char *buf; | 545 | unsigned char *buf; |
565 | int copied =0; | 546 | int copied = 0; |
566 | 547 | ||
567 | static int intCount, RxIntCnt; | 548 | static int intCount, RxIntCnt; |
568 | 549 | ||
569 | /* | 550 | /* |
570 | ** The receive data process is to remove packets from the | 551 | ** The receive data process is to remove packets from the |
571 | ** PHB until there aren't any more or the current cblock | 552 | ** PHB until there aren't any more or the current cblock |
572 | ** is full. When this occurs, there will be some left over | 553 | ** is full. When this occurs, there will be some left over |
573 | ** data in the packet, that we must do something with. | 554 | ** data in the packet, that we must do something with. |
574 | ** As we haven't unhooked the packet from the read list | 555 | ** As we haven't unhooked the packet from the read list |
575 | ** yet, we can just leave the packet there, having first | 556 | ** yet, we can just leave the packet there, having first |
576 | ** made a note of how far we got. This means that we need | 557 | ** made a note of how far we got. This means that we need |
577 | ** a pointer per port saying where we start taking the | 558 | ** a pointer per port saying where we start taking the |
578 | ** data from - this will normally be zero, but when we | 559 | ** data from - this will normally be zero, but when we |
579 | ** run out of space it will be set to the offset of the | 560 | ** run out of space it will be set to the offset of the |
580 | ** next byte to copy from the packet data area. The packet | 561 | ** next byte to copy from the packet data area. The packet |
581 | ** length field is decremented by the number of bytes that | 562 | ** length field is decremented by the number of bytes that |
582 | ** we succesfully removed from the packet. When this reaches | 563 | ** we succesfully removed from the packet. When this reaches |
583 | ** zero, we reset the offset pointer to be zero, and free | 564 | ** zero, we reset the offset pointer to be zero, and free |
584 | ** the packet from the front of the queue. | 565 | ** the packet from the front of the queue. |
585 | */ | 566 | */ |
586 | 567 | ||
587 | intCount++; | 568 | intCount++; |
588 | 569 | ||
589 | TtyP = PortP->gs.tty; | 570 | TtyP = PortP->gs.tty; |
590 | if (!TtyP) { | 571 | if (!TtyP) { |
591 | rio_dprintk (RIO_DEBUG_INTR, "RIOReceive: tty is null. \n"); | 572 | rio_dprintk(RIO_DEBUG_INTR, "RIOReceive: tty is null. \n"); |
592 | return; | 573 | return; |
593 | } | ||
594 | |||
595 | if (PortP->State & RIO_THROTTLE_RX) { | ||
596 | rio_dprintk (RIO_DEBUG_INTR, "RIOReceive: Throttled. Can't handle more input.\n"); | ||
597 | return; | ||
598 | } | ||
599 | |||
600 | if ( PortP->State & RIO_DELETED ) | ||
601 | { | ||
602 | while ( can_remove_receive( &PacketP, PortP ) ) | ||
603 | { | ||
604 | remove_receive( PortP ); | ||
605 | put_free_end( PortP->HostP, PacketP ); | ||
606 | } | 574 | } |
607 | } | 575 | |
608 | else | 576 | if (PortP->State & RIO_THROTTLE_RX) { |
609 | { | 577 | rio_dprintk(RIO_DEBUG_INTR, "RIOReceive: Throttled. Can't handle more input.\n"); |
610 | /* | 578 | return; |
611 | ** loop, just so long as: | 579 | } |
612 | ** i ) there's some data ( i.e. can_remove_receive ) | 580 | |
613 | ** ii ) we haven't been blocked | 581 | if (PortP->State & RIO_DELETED) { |
614 | ** iii ) there's somewhere to put the data | 582 | while (can_remove_receive(&PacketP, PortP)) { |
615 | ** iv ) we haven't outstayed our welcome | 583 | remove_receive(PortP); |
616 | */ | 584 | put_free_end(PortP->HostP, PacketP); |
617 | transCount = 1; | 585 | } |
618 | while ( can_remove_receive(&PacketP, PortP) | 586 | } else { |
619 | && transCount) | 587 | /* |
620 | { | 588 | ** loop, just so long as: |
589 | ** i ) there's some data ( i.e. can_remove_receive ) | ||
590 | ** ii ) we haven't been blocked | ||
591 | ** iii ) there's somewhere to put the data | ||
592 | ** iv ) we haven't outstayed our welcome | ||
593 | */ | ||
594 | transCount = 1; | ||
595 | while (can_remove_receive(&PacketP, PortP) | ||
596 | && transCount) { | ||
621 | #ifdef STATS | 597 | #ifdef STATS |
622 | PortP->Stat.RxIntCnt++; | 598 | PortP->Stat.RxIntCnt++; |
623 | #endif /* STATS */ | 599 | #endif /* STATS */ |
624 | RxIntCnt++; | 600 | RxIntCnt++; |
625 | 601 | ||
626 | /* | 602 | /* |
627 | ** check that it is not a command! | 603 | ** check that it is not a command! |
628 | */ | 604 | */ |
629 | if ( PacketP->len & PKT_CMD_BIT ) { | 605 | if (PacketP->len & PKT_CMD_BIT) { |
630 | rio_dprintk (RIO_DEBUG_INTR, "RIO: unexpected command packet received on PHB\n"); | 606 | rio_dprintk(RIO_DEBUG_INTR, "RIO: unexpected command packet received on PHB\n"); |
631 | /* rio_dprint(RIO_DEBUG_INTR, (" sysport = %d\n", p->RIOPortp->PortNum)); */ | 607 | /* rio_dprint(RIO_DEBUG_INTR, (" sysport = %d\n", p->RIOPortp->PortNum)); */ |
632 | rio_dprintk (RIO_DEBUG_INTR, " dest_unit = %d\n", PacketP->dest_unit); | 608 | rio_dprintk(RIO_DEBUG_INTR, " dest_unit = %d\n", PacketP->dest_unit); |
633 | rio_dprintk (RIO_DEBUG_INTR, " dest_port = %d\n", PacketP->dest_port); | 609 | rio_dprintk(RIO_DEBUG_INTR, " dest_port = %d\n", PacketP->dest_port); |
634 | rio_dprintk (RIO_DEBUG_INTR, " src_unit = %d\n", PacketP->src_unit); | 610 | rio_dprintk(RIO_DEBUG_INTR, " src_unit = %d\n", PacketP->src_unit); |
635 | rio_dprintk (RIO_DEBUG_INTR, " src_port = %d\n", PacketP->src_port); | 611 | rio_dprintk(RIO_DEBUG_INTR, " src_port = %d\n", PacketP->src_port); |
636 | rio_dprintk (RIO_DEBUG_INTR, " len = %d\n", PacketP->len); | 612 | rio_dprintk(RIO_DEBUG_INTR, " len = %d\n", PacketP->len); |
637 | rio_dprintk (RIO_DEBUG_INTR, " control = %d\n", PacketP->control); | 613 | rio_dprintk(RIO_DEBUG_INTR, " control = %d\n", PacketP->control); |
638 | rio_dprintk (RIO_DEBUG_INTR, " csum = %d\n", PacketP->csum); | 614 | rio_dprintk(RIO_DEBUG_INTR, " csum = %d\n", PacketP->csum); |
639 | rio_dprintk (RIO_DEBUG_INTR, " data bytes: "); | 615 | rio_dprintk(RIO_DEBUG_INTR, " data bytes: "); |
640 | for ( DataCnt=0; DataCnt<PKT_MAX_DATA_LEN; DataCnt++ ) | 616 | for (DataCnt = 0; DataCnt < PKT_MAX_DATA_LEN; DataCnt++) |
641 | rio_dprintk (RIO_DEBUG_INTR, "%d\n", PacketP->data[DataCnt]); | 617 | rio_dprintk(RIO_DEBUG_INTR, "%d\n", PacketP->data[DataCnt]); |
642 | remove_receive( PortP ); | 618 | remove_receive(PortP); |
643 | put_free_end( PortP->HostP, PacketP ); | 619 | put_free_end(PortP->HostP, PacketP); |
644 | continue; /* with next packet */ | 620 | continue; /* with next packet */ |
645 | } | 621 | } |
646 | 622 | ||
647 | /* | 623 | /* |
648 | ** How many characters can we move 'upstream' ? | 624 | ** How many characters can we move 'upstream' ? |
649 | ** | 625 | ** |
650 | ** Determine the minimum of the amount of data | 626 | ** Determine the minimum of the amount of data |
651 | ** available and the amount of space in which to | 627 | ** available and the amount of space in which to |
652 | ** put it. | 628 | ** put it. |
653 | ** | 629 | ** |
654 | ** 1. Get the packet length by masking 'len' | 630 | ** 1. Get the packet length by masking 'len' |
655 | ** for only the length bits. | 631 | ** for only the length bits. |
656 | ** 2. Available space is [buffer size] - [space used] | 632 | ** 2. Available space is [buffer size] - [space used] |
657 | ** | 633 | ** |
658 | ** Transfer count is the minimum of packet length | 634 | ** Transfer count is the minimum of packet length |
659 | ** and available space. | 635 | ** and available space. |
660 | */ | 636 | */ |
661 | 637 | ||
662 | transCount = tty_buffer_request_room(TtyP, PacketP->len & PKT_LEN_MASK); | 638 | transCount = tty_buffer_request_room(TtyP, PacketP->len & PKT_LEN_MASK); |
663 | rio_dprintk (RIO_DEBUG_REC, "port %d: Copy %d bytes\n", | 639 | rio_dprintk(RIO_DEBUG_REC, "port %d: Copy %d bytes\n", PortP->PortNum, transCount); |
664 | PortP->PortNum, transCount); | 640 | /* |
665 | /* | 641 | ** To use the following 'kkprintfs' for debugging - change the '#undef' |
666 | ** To use the following 'kkprintfs' for debugging - change the '#undef' | 642 | ** to '#define', (this is the only place ___DEBUG_IT___ occurs in the |
667 | ** to '#define', (this is the only place ___DEBUG_IT___ occurs in the | 643 | ** driver). |
668 | ** driver). | 644 | */ |
669 | */ | ||
670 | #undef ___DEBUG_IT___ | 645 | #undef ___DEBUG_IT___ |
671 | #ifdef ___DEBUG_IT___ | 646 | #ifdef ___DEBUG_IT___ |
672 | kkprintf("I:%d R:%d P:%d Q:%d C:%d F:%x ", | 647 | kkprintf("I:%d R:%d P:%d Q:%d C:%d F:%x ", intCount, RxIntCnt, PortP->PortNum, TtyP->rxqueue.count, transCount, TtyP->flags); |
673 | intCount, | ||
674 | RxIntCnt, | ||
675 | PortP->PortNum, | ||
676 | TtyP->rxqueue.count, | ||
677 | transCount, | ||
678 | TtyP->flags ); | ||
679 | #endif | 648 | #endif |
680 | ptr = (uchar *) PacketP->data + PortP->RxDataStart; | 649 | ptr = (uchar *) PacketP->data + PortP->RxDataStart; |
681 | 650 | ||
682 | tty_prepare_flip_string(TtyP, &buf, transCount); | 651 | tty_prepare_flip_string(TtyP, &buf, transCount); |
683 | rio_memcpy_fromio (buf, ptr, transCount); | 652 | rio_memcpy_fromio(buf, ptr, transCount); |
684 | #ifdef STATS | 653 | #ifdef STATS |
685 | /* | 654 | /* |
686 | ** keep a count for statistical purposes | 655 | ** keep a count for statistical purposes |
687 | */ | 656 | */ |
688 | PortP->Stat.RxCharCnt += transCount; | 657 | PortP->Stat.RxCharCnt += transCount; |
689 | #endif | 658 | #endif |
690 | PortP->RxDataStart += transCount; | 659 | PortP->RxDataStart += transCount; |
691 | PacketP->len -= transCount; | 660 | PacketP->len -= transCount; |
692 | copied += transCount; | 661 | copied += transCount; |
693 | 662 | ||
694 | 663 | ||
695 | #ifdef ___DEBUG_IT___ | 664 | #ifdef ___DEBUG_IT___ |
696 | kkprintf("T:%d L:%d\n", DataCnt, PacketP->len ); | 665 | kkprintf("T:%d L:%d\n", DataCnt, PacketP->len); |
697 | #endif | 666 | #endif |
698 | 667 | ||
699 | if ( PacketP->len == 0 ) | 668 | if (PacketP->len == 0) { |
700 | { | ||
701 | /* | 669 | /* |
702 | ** If we have emptied the packet, then we can | 670 | ** If we have emptied the packet, then we can |
703 | ** free it, and reset the start pointer for | 671 | ** free it, and reset the start pointer for |
704 | ** the next packet. | 672 | ** the next packet. |
705 | */ | 673 | */ |
706 | remove_receive( PortP ); | 674 | remove_receive(PortP); |
707 | put_free_end( PortP->HostP, PacketP ); | 675 | put_free_end(PortP->HostP, PacketP); |
708 | PortP->RxDataStart = 0; | 676 | PortP->RxDataStart = 0; |
709 | #ifdef STATS | 677 | #ifdef STATS |
710 | /* | 678 | /* |
711 | ** more lies ( oops, I mean statistics ) | 679 | ** more lies ( oops, I mean statistics ) |
712 | */ | 680 | */ |
713 | PortP->Stat.RxPktCnt++; | 681 | PortP->Stat.RxPktCnt++; |
714 | #endif /* STATS */ | 682 | #endif /* STATS */ |
715 | } | 683 | } |
684 | } | ||
685 | } | ||
686 | if (copied) { | ||
687 | rio_dprintk(RIO_DEBUG_REC, "port %d: pushing tty flip buffer: %d total bytes copied.\n", PortP->PortNum, copied); | ||
688 | tty_flip_buffer_push(TtyP); | ||
716 | } | 689 | } |
717 | } | ||
718 | if (copied) { | ||
719 | rio_dprintk (RIO_DEBUG_REC, "port %d: pushing tty flip buffer: %d total bytes copied.\n", PortP->PortNum, copied); | ||
720 | tty_flip_buffer_push (TtyP); | ||
721 | } | ||
722 | 690 | ||
723 | return; | 691 | return; |
724 | } | 692 | } |
725 | 693 | ||
726 | #ifdef FUTURE_RELEASE | 694 | #ifdef FUTURE_RELEASE |
@@ -728,221 +696,210 @@ struct Port * PortP; | |||
728 | ** The proc routine called by the line discipline to do the work for it. | 696 | ** The proc routine called by the line discipline to do the work for it. |
729 | ** The proc routine works hand in hand with the interrupt routine. | 697 | ** The proc routine works hand in hand with the interrupt routine. |
730 | */ | 698 | */ |
731 | int | 699 | int riotproc(p, tp, cmd, port) |
732 | riotproc(p, tp, cmd, port) | 700 | struct rio_info *p; |
733 | struct rio_info * p; | ||
734 | register struct ttystatics *tp; | 701 | register struct ttystatics *tp; |
735 | int cmd; | 702 | int cmd; |
736 | int port; | 703 | int port; |
737 | { | 704 | { |
738 | register struct Port *PortP; | 705 | register struct Port *PortP; |
739 | int SysPort; | 706 | int SysPort; |
740 | struct PKT *PacketP; | 707 | struct PKT *PacketP; |
741 | 708 | ||
742 | SysPort = port; /* Believe me, it works. */ | 709 | SysPort = port; /* Believe me, it works. */ |
743 | 710 | ||
744 | if ( SysPort < 0 || SysPort >= RIO_PORTS ) { | 711 | if (SysPort < 0 || SysPort >= RIO_PORTS) { |
745 | rio_dprintk (RIO_DEBUG_INTR, "Illegal port %d derived from TTY in riotproc()\n",SysPort); | 712 | rio_dprintk(RIO_DEBUG_INTR, "Illegal port %d derived from TTY in riotproc()\n", SysPort); |
746 | return 0; | 713 | return 0; |
747 | } | 714 | } |
748 | PortP = p->RIOPortp[SysPort]; | 715 | PortP = p->RIOPortp[SysPort]; |
749 | 716 | ||
750 | if ((uint)PortP->PhbP < (uint)PortP->Caddr || | 717 | if ((uint) PortP->PhbP < (uint) PortP->Caddr || (uint) PortP->PhbP >= (uint) PortP->Caddr + SIXTY_FOUR_K) { |
751 | (uint)PortP->PhbP >= (uint)PortP->Caddr+SIXTY_FOUR_K ) { | 718 | rio_dprintk(RIO_DEBUG_INTR, "RIO: NULL or BAD PhbP on sys port %d in proc routine\n", SysPort); |
752 | rio_dprintk (RIO_DEBUG_INTR, "RIO: NULL or BAD PhbP on sys port %d in proc routine\n", | 719 | rio_dprintk(RIO_DEBUG_INTR, " PortP = 0x%x\n", PortP); |
753 | SysPort); | 720 | rio_dprintk(RIO_DEBUG_INTR, " PortP->PhbP = 0x%x\n", PortP->PhbP); |
754 | rio_dprintk (RIO_DEBUG_INTR, " PortP = 0x%x\n",PortP); | 721 | rio_dprintk(RIO_DEBUG_INTR, " PortP->Caddr = 0x%x\n", PortP->PhbP); |
755 | rio_dprintk (RIO_DEBUG_INTR, " PortP->PhbP = 0x%x\n",PortP->PhbP); | 722 | rio_dprintk(RIO_DEBUG_INTR, " PortP->HostPort = 0x%x\n", PortP->HostPort); |
756 | rio_dprintk (RIO_DEBUG_INTR, " PortP->Caddr = 0x%x\n",PortP->PhbP); | ||
757 | rio_dprintk (RIO_DEBUG_INTR, " PortP->HostPort = 0x%x\n",PortP->HostPort); | ||
758 | return 0; | 723 | return 0; |
759 | } | 724 | } |
760 | 725 | ||
761 | switch(cmd) { | 726 | switch (cmd) { |
762 | case T_WFLUSH: | 727 | case T_WFLUSH: |
763 | rio_dprintk (RIO_DEBUG_INTR, "T_WFLUSH\n"); | 728 | rio_dprintk(RIO_DEBUG_INTR, "T_WFLUSH\n"); |
729 | /* | ||
730 | ** Because of the spooky way the RIO works, we don't need | ||
731 | ** to issue a flush command on any of the SET*F commands, | ||
732 | ** as that causes trouble with getty and login, which issue | ||
733 | ** these commands to incur a READ flush, and rely on the fact | ||
734 | ** that the line discipline does a wait for drain for them. | ||
735 | ** As the rio doesn't wait for drain, the write flush would | ||
736 | ** destroy the Password: prompt. This isn't very friendly, so | ||
737 | ** here we only issue a WFLUSH command if we are in the interrupt | ||
738 | ** routine, or we aren't executing a SET*F command. | ||
739 | */ | ||
740 | if (PortP->HostP->InIntr || !PortP->FlushCmdBodge) { | ||
764 | /* | 741 | /* |
765 | ** Because of the spooky way the RIO works, we don't need | 742 | ** form a wflush packet - 1 byte long, no data |
766 | ** to issue a flush command on any of the SET*F commands, | 743 | */ |
767 | ** as that causes trouble with getty and login, which issue | 744 | if (PortP->State & RIO_DELETED) { |
768 | ** these commands to incur a READ flush, and rely on the fact | 745 | rio_dprintk(RIO_DEBUG_INTR, "WFLUSH on deleted RTA\n"); |
769 | ** that the line discipline does a wait for drain for them. | 746 | } else { |
770 | ** As the rio doesn't wait for drain, the write flush would | 747 | if (RIOPreemptiveCmd(p, PortP, WFLUSH) == RIO_FAIL) { |
771 | ** destroy the Password: prompt. This isn't very friendly, so | 748 | rio_dprintk(RIO_DEBUG_INTR, "T_WFLUSH Command failed\n"); |
772 | ** here we only issue a WFLUSH command if we are in the interrupt | 749 | } else |
773 | ** routine, or we aren't executing a SET*F command. | 750 | rio_dprintk(RIO_DEBUG_INTR, "T_WFLUSH Command\n"); |
774 | */ | ||
775 | if ( PortP->HostP->InIntr || !PortP->FlushCmdBodge ) { | ||
776 | /* | ||
777 | ** form a wflush packet - 1 byte long, no data | ||
778 | */ | ||
779 | if ( PortP->State & RIO_DELETED ) { | ||
780 | rio_dprintk (RIO_DEBUG_INTR, "WFLUSH on deleted RTA\n"); | ||
781 | } | ||
782 | else { | ||
783 | if ( RIOPreemptiveCmd(p, PortP, WFLUSH ) == RIO_FAIL ) { | ||
784 | rio_dprintk (RIO_DEBUG_INTR, "T_WFLUSH Command failed\n"); | ||
785 | } | ||
786 | else | ||
787 | rio_dprintk (RIO_DEBUG_INTR, "T_WFLUSH Command\n"); | ||
788 | } | ||
789 | /* | ||
790 | ** WFLUSH operation - flush the data! | ||
791 | */ | ||
792 | PortP->TxBufferIn = PortP->TxBufferOut = 0; | ||
793 | } | ||
794 | else { | ||
795 | rio_dprintk (RIO_DEBUG_INTR, "T_WFLUSH Command ignored\n"); | ||
796 | } | 751 | } |
797 | /* | 752 | /* |
798 | ** sort out the line discipline | 753 | ** WFLUSH operation - flush the data! |
799 | */ | 754 | */ |
800 | if (PortP->CookMode == COOK_WELL) | 755 | PortP->TxBufferIn = PortP->TxBufferOut = 0; |
801 | goto start; | 756 | } else { |
802 | break; | 757 | rio_dprintk(RIO_DEBUG_INTR, "T_WFLUSH Command ignored\n"); |
803 | 758 | } | |
804 | case T_RESUME: | 759 | /* |
805 | rio_dprintk (RIO_DEBUG_INTR, "T_RESUME\n"); | 760 | ** sort out the line discipline |
806 | /* | 761 | */ |
807 | ** send pre-emptive resume packet | 762 | if (PortP->CookMode == COOK_WELL) |
808 | */ | 763 | goto start; |
809 | if ( PortP->State & RIO_DELETED ) { | 764 | break; |
810 | rio_dprintk (RIO_DEBUG_INTR, "RESUME on deleted RTA\n"); | 765 | |
766 | case T_RESUME: | ||
767 | rio_dprintk(RIO_DEBUG_INTR, "T_RESUME\n"); | ||
768 | /* | ||
769 | ** send pre-emptive resume packet | ||
770 | */ | ||
771 | if (PortP->State & RIO_DELETED) { | ||
772 | rio_dprintk(RIO_DEBUG_INTR, "RESUME on deleted RTA\n"); | ||
773 | } else { | ||
774 | if (RIOPreemptiveCmd(p, PortP, RESUME) == RIO_FAIL) { | ||
775 | rio_dprintk(RIO_DEBUG_INTR, "T_RESUME Command failed\n"); | ||
811 | } | 776 | } |
812 | else { | 777 | } |
813 | if ( RIOPreemptiveCmd(p, PortP, RESUME ) == RIO_FAIL ) { | 778 | /* |
814 | rio_dprintk (RIO_DEBUG_INTR, "T_RESUME Command failed\n"); | 779 | ** and re-start the sender software! |
815 | } | 780 | */ |
781 | if (PortP->CookMode == COOK_WELL) | ||
782 | goto start; | ||
783 | break; | ||
784 | |||
785 | case T_TIME: | ||
786 | rio_dprintk(RIO_DEBUG_INTR, "T_TIME\n"); | ||
787 | /* | ||
788 | ** T_TIME is called when xDLY is set in oflags and | ||
789 | ** the line discipline timeout has expired. It's | ||
790 | ** function in life is to clear the TIMEOUT flag | ||
791 | ** and to re-start output to the port. | ||
792 | */ | ||
793 | /* | ||
794 | ** Fall through and re-start output | ||
795 | */ | ||
796 | case T_OUTPUT: | ||
797 | start: | ||
798 | if (PortP->MagicFlags & MAGIC_FLUSH) { | ||
799 | PortP->MagicFlags |= MORE_OUTPUT_EYGOR; | ||
800 | return 0; | ||
801 | } | ||
802 | RIOTxEnable((char *) PortP); | ||
803 | PortP->MagicFlags &= ~MORE_OUTPUT_EYGOR; | ||
804 | /*rio_dprint(RIO_DEBUG_INTR, PortP,DBG_PROC,"T_OUTPUT finished\n"); */ | ||
805 | break; | ||
806 | |||
807 | case T_SUSPEND: | ||
808 | rio_dprintk(RIO_DEBUG_INTR, "T_SUSPEND\n"); | ||
809 | /* | ||
810 | ** send a suspend pre-emptive packet. | ||
811 | */ | ||
812 | if (PortP->State & RIO_DELETED) { | ||
813 | rio_dprintk(RIO_DEBUG_INTR, "SUSPEND deleted RTA\n"); | ||
814 | } else { | ||
815 | if (RIOPreemptiveCmd(p, PortP, SUSPEND) == RIO_FAIL) { | ||
816 | rio_dprintk(RIO_DEBUG_INTR, "T_SUSPEND Command failed\n"); | ||
816 | } | 817 | } |
817 | /* | 818 | } |
818 | ** and re-start the sender software! | 819 | /* |
819 | */ | 820 | ** done! |
820 | if (PortP->CookMode == COOK_WELL) | 821 | */ |
821 | goto start; | 822 | break; |
822 | break; | 823 | |
823 | 824 | case T_BLOCK: | |
824 | case T_TIME: | 825 | rio_dprintk(RIO_DEBUG_INTR, "T_BLOCK\n"); |
825 | rio_dprintk (RIO_DEBUG_INTR, "T_TIME\n"); | 826 | break; |
826 | /* | 827 | |
827 | ** T_TIME is called when xDLY is set in oflags and | 828 | case T_RFLUSH: |
828 | ** the line discipline timeout has expired. It's | 829 | rio_dprintk(RIO_DEBUG_INTR, "T_RFLUSH\n"); |
829 | ** function in life is to clear the TIMEOUT flag | 830 | if (PortP->State & RIO_DELETED) { |
830 | ** and to re-start output to the port. | 831 | rio_dprintk(RIO_DEBUG_INTR, "RFLUSH on deleted RTA\n"); |
831 | */ | 832 | PortP->RxDataStart = 0; |
832 | /* | 833 | } else { |
833 | ** Fall through and re-start output | 834 | if (RIOPreemptiveCmd(p, PortP, RFLUSH) == RIO_FAIL) { |
834 | */ | 835 | rio_dprintk(RIO_DEBUG_INTR, "T_RFLUSH Command failed\n"); |
835 | case T_OUTPUT: | ||
836 | start: | ||
837 | if ( PortP->MagicFlags & MAGIC_FLUSH ) { | ||
838 | PortP->MagicFlags |= MORE_OUTPUT_EYGOR; | ||
839 | return 0; | 836 | return 0; |
840 | } | 837 | } |
841 | RIOTxEnable((char *)PortP); | 838 | PortP->RxDataStart = 0; |
842 | PortP->MagicFlags &= ~MORE_OUTPUT_EYGOR; | 839 | while (can_remove_receive(&PacketP, PortP)) { |
843 | /*rio_dprint(RIO_DEBUG_INTR, PortP,DBG_PROC,"T_OUTPUT finished\n");*/ | 840 | remove_receive(PortP); |
844 | break; | 841 | ShowPacket(DBG_PROC, PacketP); |
845 | 842 | put_free_end(PortP->HostP, PacketP); | |
846 | case T_SUSPEND: | ||
847 | rio_dprintk (RIO_DEBUG_INTR, "T_SUSPEND\n"); | ||
848 | /* | ||
849 | ** send a suspend pre-emptive packet. | ||
850 | */ | ||
851 | if ( PortP->State & RIO_DELETED ) { | ||
852 | rio_dprintk (RIO_DEBUG_INTR, "SUSPEND deleted RTA\n"); | ||
853 | } | ||
854 | else { | ||
855 | if ( RIOPreemptiveCmd(p, PortP, SUSPEND ) == RIO_FAIL ) { | ||
856 | rio_dprintk (RIO_DEBUG_INTR, "T_SUSPEND Command failed\n"); | ||
857 | } | ||
858 | } | 843 | } |
859 | /* | 844 | if (PortP->PhbP->handshake == PHB_HANDSHAKE_SET) { |
860 | ** done! | 845 | /* |
861 | */ | 846 | ** MAGIC! |
862 | break; | 847 | */ |
863 | 848 | rio_dprintk(RIO_DEBUG_INTR, "Set receive handshake bit\n"); | |
864 | case T_BLOCK: | 849 | PortP->PhbP->handshake |= PHB_HANDSHAKE_RESET; |
865 | rio_dprintk (RIO_DEBUG_INTR, "T_BLOCK\n"); | ||
866 | break; | ||
867 | |||
868 | case T_RFLUSH: | ||
869 | rio_dprintk (RIO_DEBUG_INTR, "T_RFLUSH\n"); | ||
870 | if ( PortP->State & RIO_DELETED ) { | ||
871 | rio_dprintk (RIO_DEBUG_INTR, "RFLUSH on deleted RTA\n"); | ||
872 | PortP->RxDataStart = 0; | ||
873 | } | ||
874 | else { | ||
875 | if ( RIOPreemptiveCmd( p, PortP, RFLUSH ) == RIO_FAIL ) { | ||
876 | rio_dprintk (RIO_DEBUG_INTR, "T_RFLUSH Command failed\n"); | ||
877 | return 0; | ||
878 | } | ||
879 | PortP->RxDataStart = 0; | ||
880 | while ( can_remove_receive(&PacketP, PortP) ) { | ||
881 | remove_receive(PortP); | ||
882 | ShowPacket(DBG_PROC, PacketP ); | ||
883 | put_free_end(PortP->HostP, PacketP ); | ||
884 | } | ||
885 | if ( PortP->PhbP->handshake == PHB_HANDSHAKE_SET ) { | ||
886 | /* | ||
887 | ** MAGIC! | ||
888 | */ | ||
889 | rio_dprintk (RIO_DEBUG_INTR, "Set receive handshake bit\n"); | ||
890 | PortP->PhbP->handshake |= PHB_HANDSHAKE_RESET; | ||
891 | } | ||
892 | } | ||
893 | break; | ||
894 | /* FALLTHROUGH */ | ||
895 | case T_UNBLOCK: | ||
896 | rio_dprintk (RIO_DEBUG_INTR, "T_UNBLOCK\n"); | ||
897 | /* | ||
898 | ** If there is any data to receive set a timeout to service it. | ||
899 | */ | ||
900 | RIOReceive(p, PortP); | ||
901 | break; | ||
902 | |||
903 | case T_BREAK: | ||
904 | rio_dprintk (RIO_DEBUG_INTR, "T_BREAK\n"); | ||
905 | /* | ||
906 | ** Send a break command. For Sys V | ||
907 | ** this is a timed break, so we | ||
908 | ** send a SBREAK[time] packet | ||
909 | */ | ||
910 | /* | ||
911 | ** Build a BREAK command | ||
912 | */ | ||
913 | if ( PortP->State & RIO_DELETED ) { | ||
914 | rio_dprintk (RIO_DEBUG_INTR, "BREAK on deleted RTA\n"); | ||
915 | } | 850 | } |
916 | else { | 851 | } |
917 | if (RIOShortCommand(PortP,SBREAK,2, | 852 | break; |
918 | p->RIOConf.BreakInterval)==RIO_FAIL) { | 853 | /* FALLTHROUGH */ |
919 | rio_dprintk (RIO_DEBUG_INTR, "SBREAK RIOShortCommand failed\n"); | 854 | case T_UNBLOCK: |
920 | } | 855 | rio_dprintk(RIO_DEBUG_INTR, "T_UNBLOCK\n"); |
856 | /* | ||
857 | ** If there is any data to receive set a timeout to service it. | ||
858 | */ | ||
859 | RIOReceive(p, PortP); | ||
860 | break; | ||
861 | |||
862 | case T_BREAK: | ||
863 | rio_dprintk(RIO_DEBUG_INTR, "T_BREAK\n"); | ||
864 | /* | ||
865 | ** Send a break command. For Sys V | ||
866 | ** this is a timed break, so we | ||
867 | ** send a SBREAK[time] packet | ||
868 | */ | ||
869 | /* | ||
870 | ** Build a BREAK command | ||
871 | */ | ||
872 | if (PortP->State & RIO_DELETED) { | ||
873 | rio_dprintk(RIO_DEBUG_INTR, "BREAK on deleted RTA\n"); | ||
874 | } else { | ||
875 | if (RIOShortCommand(PortP, SBREAK, 2, p->RIOConf.BreakInterval) == RIO_FAIL) { | ||
876 | rio_dprintk(RIO_DEBUG_INTR, "SBREAK RIOShortCommand failed\n"); | ||
921 | } | 877 | } |
922 | 878 | } | |
923 | /* | 879 | |
924 | ** done! | 880 | /* |
925 | */ | 881 | ** done! |
926 | break; | 882 | */ |
927 | 883 | break; | |
928 | case T_INPUT: | 884 | |
929 | rio_dprintk (RIO_DEBUG_INTR, "Proc T_INPUT called - I don't know what to do!\n"); | 885 | case T_INPUT: |
930 | break; | 886 | rio_dprintk(RIO_DEBUG_INTR, "Proc T_INPUT called - I don't know what to do!\n"); |
931 | case T_PARM: | 887 | break; |
932 | rio_dprintk (RIO_DEBUG_INTR, "Proc T_PARM called - I don't know what to do!\n"); | 888 | case T_PARM: |
933 | break; | 889 | rio_dprintk(RIO_DEBUG_INTR, "Proc T_PARM called - I don't know what to do!\n"); |
934 | 890 | break; | |
935 | case T_SWTCH: | 891 | |
936 | rio_dprintk (RIO_DEBUG_INTR, "Proc T_SWTCH called - I don't know what to do!\n"); | 892 | case T_SWTCH: |
937 | break; | 893 | rio_dprintk(RIO_DEBUG_INTR, "Proc T_SWTCH called - I don't know what to do!\n"); |
938 | 894 | break; | |
939 | default: | 895 | |
940 | rio_dprintk (RIO_DEBUG_INTR, "Proc UNKNOWN command %d\n",cmd); | 896 | default: |
897 | rio_dprintk(RIO_DEBUG_INTR, "Proc UNKNOWN command %d\n", cmd); | ||
941 | } | 898 | } |
942 | /* | 899 | /* |
943 | ** T_OUTPUT returns without passing through this point! | 900 | ** T_OUTPUT returns without passing through this point! |
944 | */ | 901 | */ |
945 | /*rio_dprint(RIO_DEBUG_INTR, PortP,DBG_PROC,"riotproc done\n");*/ | 902 | /*rio_dprint(RIO_DEBUG_INTR, PortP,DBG_PROC,"riotproc done\n"); */ |
946 | return(0); | 903 | return (0); |
947 | } | 904 | } |
948 | #endif | 905 | #endif |
diff --git a/drivers/char/rio/rioioctl.h b/drivers/char/rio/rioioctl.h index c3d679733c9a..14b83fae75c8 100644 --- a/drivers/char/rio/rioioctl.h +++ b/drivers/char/rio/rioioctl.h | |||
@@ -42,14 +42,14 @@ static char *_rioioctl_h_sccs_ = "@(#)rioioctl.h 1.2"; | |||
42 | */ | 42 | */ |
43 | 43 | ||
44 | struct portStats { | 44 | struct portStats { |
45 | int port; | 45 | int port; |
46 | int gather; | 46 | int gather; |
47 | ulong txchars; | 47 | ulong txchars; |
48 | ulong rxchars; | 48 | ulong rxchars; |
49 | ulong opens; | 49 | ulong opens; |
50 | ulong closes; | 50 | ulong closes; |
51 | ulong ioctls; | 51 | ulong ioctls; |
52 | }; | 52 | }; |
53 | 53 | ||
54 | 54 | ||
55 | #define rIOC ('r'<<8) | 55 | #define rIOC ('r'<<8) |
@@ -100,4 +100,4 @@ struct portStats { | |||
100 | #define RIO_RESET_PORT_STATS (RIOC | 194) | 100 | #define RIO_RESET_PORT_STATS (RIOC | 194) |
101 | #define RIO_GET_PORT_STATS (RIOC | 195) | 101 | #define RIO_GET_PORT_STATS (RIOC | 195) |
102 | 102 | ||
103 | #endif /* __rioioctl_h__ */ | 103 | #endif /* __rioioctl_h__ */ |
diff --git a/drivers/char/rio/rioparam.c b/drivers/char/rio/rioparam.c index f10916326ecc..4cc7f4942bfc 100644 --- a/drivers/char/rio/rioparam.c +++ b/drivers/char/rio/rioparam.c | |||
@@ -157,46 +157,44 @@ static char *_rioparam_c_sccs_ = "@(#)rioparam.c 1.3"; | |||
157 | ** NB. for MPX | 157 | ** NB. for MPX |
158 | ** tty lock must NOT have been previously acquired. | 158 | ** tty lock must NOT have been previously acquired. |
159 | */ | 159 | */ |
160 | int | 160 | int RIOParam(PortP, cmd, Modem, SleepFlag) |
161 | RIOParam(PortP, cmd, Modem, SleepFlag) | ||
162 | struct Port *PortP; | 161 | struct Port *PortP; |
163 | int cmd; | 162 | int cmd; |
164 | int Modem; | 163 | int Modem; |
165 | int SleepFlag; | 164 | int SleepFlag; |
166 | { | 165 | { |
167 | register struct tty_struct *TtyP; | 166 | register struct tty_struct *TtyP; |
168 | int retval; | 167 | int retval; |
169 | register struct phb_param *phb_param_ptr; | 168 | register struct phb_param *phb_param_ptr; |
170 | PKT *PacketP; | 169 | PKT *PacketP; |
171 | int res; | 170 | int res; |
172 | uchar Cor1=0, Cor2=0, Cor4=0, Cor5=0; | 171 | uchar Cor1 = 0, Cor2 = 0, Cor4 = 0, Cor5 = 0; |
173 | uchar TxXon=0, TxXoff=0, RxXon=0, RxXoff=0; | 172 | uchar TxXon = 0, TxXoff = 0, RxXon = 0, RxXoff = 0; |
174 | uchar LNext=0, TxBaud=0, RxBaud=0; | 173 | uchar LNext = 0, TxBaud = 0, RxBaud = 0; |
175 | int retries = 0xff; | 174 | int retries = 0xff; |
176 | unsigned long flags; | 175 | unsigned long flags; |
177 | 176 | ||
178 | func_enter (); | 177 | func_enter(); |
179 | 178 | ||
180 | TtyP = PortP->gs.tty; | 179 | TtyP = PortP->gs.tty; |
181 | 180 | ||
182 | rio_dprintk (RIO_DEBUG_PARAM, "RIOParam: Port:%d cmd:%d Modem:%d SleepFlag:%d Mapped: %d, tty=%p\n", | 181 | 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); |
183 | PortP->PortNum, cmd, Modem, SleepFlag, PortP->Mapped, TtyP); | ||
184 | 182 | ||
185 | if (!TtyP) { | 183 | if (!TtyP) { |
186 | rio_dprintk (RIO_DEBUG_PARAM, "Can't call rioparam with null tty.\n"); | 184 | rio_dprintk(RIO_DEBUG_PARAM, "Can't call rioparam with null tty.\n"); |
187 | 185 | ||
188 | func_exit (); | 186 | func_exit(); |
189 | 187 | ||
190 | return RIO_FAIL; | 188 | return RIO_FAIL; |
191 | } | 189 | } |
192 | rio_spin_lock_irqsave(&PortP->portSem, flags ); | 190 | rio_spin_lock_irqsave(&PortP->portSem, flags); |
193 | 191 | ||
194 | if (cmd == OPEN) { | 192 | if (cmd == OPEN) { |
195 | /* | 193 | /* |
196 | ** If the port is set to store or lock the parameters, and it is | 194 | ** If the port is set to store or lock the parameters, and it is |
197 | ** paramed with OPEN, we want to restore the saved port termio, but | 195 | ** paramed with OPEN, we want to restore the saved port termio, but |
198 | ** only if StoredTermio has been saved, i.e. NOT 1st open after reboot. | 196 | ** only if StoredTermio has been saved, i.e. NOT 1st open after reboot. |
199 | */ | 197 | */ |
200 | #if 0 | 198 | #if 0 |
201 | if (PortP->FirstOpen) { | 199 | if (PortP->FirstOpen) { |
202 | PortP->StoredTty.iflag = TtyP->tm.c_iflag; | 200 | PortP->StoredTty.iflag = TtyP->tm.c_iflag; |
@@ -207,9 +205,8 @@ int SleepFlag; | |||
207 | for (i = 0; i < NCC + 5; i++) | 205 | for (i = 0; i < NCC + 5; i++) |
208 | PortP->StoredTty.cc[i] = TtyP->tm.c_cc[i]; | 206 | PortP->StoredTty.cc[i] = TtyP->tm.c_cc[i]; |
209 | PortP->FirstOpen = 0; | 207 | PortP->FirstOpen = 0; |
210 | } | 208 | } else if (PortP->Store || PortP->Lock) { |
211 | else if (PortP->Store || PortP->Lock) { | 209 | rio_dprintk(RIO_DEBUG_PARAM, "OPEN: Restoring stored/locked params\n"); |
212 | rio_dprintk (RIO_DEBUG_PARAM, "OPEN: Restoring stored/locked params\n"); | ||
213 | TtyP->tm.c_iflag = PortP->StoredTty.iflag; | 210 | TtyP->tm.c_iflag = PortP->StoredTty.iflag; |
214 | TtyP->tm.c_oflag = PortP->StoredTty.oflag; | 211 | TtyP->tm.c_oflag = PortP->StoredTty.oflag; |
215 | TtyP->tm.c_cflag = PortP->StoredTty.cflag; | 212 | TtyP->tm.c_cflag = PortP->StoredTty.cflag; |
@@ -222,230 +219,222 @@ int SleepFlag; | |||
222 | } | 219 | } |
223 | 220 | ||
224 | /* | 221 | /* |
225 | ** wait for space | 222 | ** wait for space |
226 | */ | 223 | */ |
227 | while ( !(res=can_add_transmit(&PacketP,PortP)) || | 224 | while (!(res = can_add_transmit(&PacketP, PortP)) || (PortP->InUse != NOT_INUSE)) { |
228 | (PortP->InUse != NOT_INUSE) ) { | 225 | if (retries-- <= 0) { |
229 | if (retries -- <= 0) { | ||
230 | break; | 226 | break; |
231 | } | 227 | } |
232 | if ( PortP->InUse != NOT_INUSE ) { | 228 | if (PortP->InUse != NOT_INUSE) { |
233 | rio_dprintk (RIO_DEBUG_PARAM, "Port IN_USE for pre-emptive command\n"); | 229 | rio_dprintk(RIO_DEBUG_PARAM, "Port IN_USE for pre-emptive command\n"); |
234 | } | 230 | } |
235 | 231 | ||
236 | if ( !res ) { | 232 | if (!res) { |
237 | rio_dprintk (RIO_DEBUG_PARAM, "Port has no space on transmit queue\n"); | 233 | rio_dprintk(RIO_DEBUG_PARAM, "Port has no space on transmit queue\n"); |
238 | } | 234 | } |
239 | 235 | ||
240 | if ( SleepFlag != OK_TO_SLEEP ) { | 236 | if (SleepFlag != OK_TO_SLEEP) { |
241 | rio_spin_unlock_irqrestore( &PortP->portSem, flags); | 237 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); |
242 | func_exit(); | 238 | func_exit(); |
243 | 239 | ||
244 | return RIO_FAIL; | 240 | return RIO_FAIL; |
245 | } | 241 | } |
246 | 242 | ||
247 | rio_dprintk (RIO_DEBUG_PARAM, "wait for can_add_transmit\n"); | 243 | rio_dprintk(RIO_DEBUG_PARAM, "wait for can_add_transmit\n"); |
248 | rio_spin_unlock_irqrestore( &PortP->portSem, flags); | 244 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); |
249 | retval = RIODelay(PortP, HUNDRED_MS); | 245 | retval = RIODelay(PortP, HUNDRED_MS); |
250 | rio_spin_lock_irqsave( &PortP->portSem, flags); | 246 | rio_spin_lock_irqsave(&PortP->portSem, flags); |
251 | if (retval == RIO_FAIL) { | 247 | if (retval == RIO_FAIL) { |
252 | rio_dprintk (RIO_DEBUG_PARAM, "wait for can_add_transmit broken by signal\n"); | 248 | rio_dprintk(RIO_DEBUG_PARAM, "wait for can_add_transmit broken by signal\n"); |
253 | rio_spin_unlock_irqrestore( &PortP->portSem, flags); | 249 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); |
254 | pseterr(EINTR); | 250 | pseterr(EINTR); |
255 | func_exit(); | 251 | func_exit(); |
256 | 252 | ||
257 | return RIO_FAIL; | 253 | return RIO_FAIL; |
258 | } | 254 | } |
259 | if ( PortP->State & RIO_DELETED ) { | 255 | if (PortP->State & RIO_DELETED) { |
260 | rio_spin_unlock_irqrestore( &PortP->portSem, flags); | 256 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); |
261 | func_exit (); | 257 | func_exit(); |
262 | 258 | ||
263 | return RIO_SUCCESS; | 259 | return RIO_SUCCESS; |
264 | } | 260 | } |
265 | } | 261 | } |
266 | 262 | ||
267 | if (!res) { | 263 | if (!res) { |
268 | rio_spin_unlock_irqrestore( &PortP->portSem, flags); | 264 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); |
269 | func_exit (); | 265 | func_exit(); |
270 | 266 | ||
271 | return RIO_FAIL; | 267 | return RIO_FAIL; |
272 | } | 268 | } |
273 | 269 | ||
274 | rio_dprintk (RIO_DEBUG_PARAM, "can_add_transmit() returns %x\n",res); | 270 | rio_dprintk(RIO_DEBUG_PARAM, "can_add_transmit() returns %x\n", res); |
275 | rio_dprintk (RIO_DEBUG_PARAM, "Packet is 0x%x\n",(int) PacketP); | 271 | rio_dprintk(RIO_DEBUG_PARAM, "Packet is 0x%x\n", (int) PacketP); |
276 | 272 | ||
277 | phb_param_ptr = (struct phb_param *)PacketP->data; | 273 | phb_param_ptr = (struct phb_param *) PacketP->data; |
278 | 274 | ||
279 | 275 | ||
280 | #if 0 | 276 | #if 0 |
281 | /* | 277 | /* |
282 | ** COR 1 | 278 | ** COR 1 |
283 | */ | 279 | */ |
284 | if ( TtyP->tm.c_iflag & INPCK ) { | 280 | if (TtyP->tm.c_iflag & INPCK) { |
285 | rio_dprintk (RIO_DEBUG_PARAM, "Parity checking on input enabled\n"); | 281 | rio_dprintk(RIO_DEBUG_PARAM, "Parity checking on input enabled\n"); |
286 | Cor1 |= COR1_INPCK; | 282 | Cor1 |= COR1_INPCK; |
287 | } | 283 | } |
288 | #endif | 284 | #endif |
289 | 285 | ||
290 | switch ( TtyP->termios->c_cflag & CSIZE ) { | 286 | switch (TtyP->termios->c_cflag & CSIZE) { |
291 | case CS5: | 287 | case CS5: |
292 | { | 288 | { |
293 | rio_dprintk (RIO_DEBUG_PARAM, "5 bit data\n"); | 289 | rio_dprintk(RIO_DEBUG_PARAM, "5 bit data\n"); |
294 | Cor1 |= COR1_5BITS; | 290 | Cor1 |= COR1_5BITS; |
295 | break; | 291 | break; |
296 | } | 292 | } |
297 | case CS6: | 293 | case CS6: |
298 | { | 294 | { |
299 | rio_dprintk (RIO_DEBUG_PARAM, "6 bit data\n"); | 295 | rio_dprintk(RIO_DEBUG_PARAM, "6 bit data\n"); |
300 | Cor1 |= COR1_6BITS; | 296 | Cor1 |= COR1_6BITS; |
301 | break; | 297 | break; |
302 | } | 298 | } |
303 | case CS7: | 299 | case CS7: |
304 | { | 300 | { |
305 | rio_dprintk (RIO_DEBUG_PARAM, "7 bit data\n"); | 301 | rio_dprintk(RIO_DEBUG_PARAM, "7 bit data\n"); |
306 | Cor1 |= COR1_7BITS; | 302 | Cor1 |= COR1_7BITS; |
307 | break; | 303 | break; |
308 | } | 304 | } |
309 | case CS8: | 305 | case CS8: |
310 | { | 306 | { |
311 | rio_dprintk (RIO_DEBUG_PARAM, "8 bit data\n"); | 307 | rio_dprintk(RIO_DEBUG_PARAM, "8 bit data\n"); |
312 | Cor1 |= COR1_8BITS; | 308 | Cor1 |= COR1_8BITS; |
313 | break; | 309 | break; |
314 | } | 310 | } |
315 | } | 311 | } |
316 | 312 | ||
317 | if ( TtyP->termios->c_cflag & CSTOPB ) { | 313 | if (TtyP->termios->c_cflag & CSTOPB) { |
318 | rio_dprintk (RIO_DEBUG_PARAM, "2 stop bits\n"); | 314 | rio_dprintk(RIO_DEBUG_PARAM, "2 stop bits\n"); |
319 | Cor1 |= COR1_2STOP; | 315 | Cor1 |= COR1_2STOP; |
320 | } | 316 | } else { |
321 | else { | 317 | rio_dprintk(RIO_DEBUG_PARAM, "1 stop bit\n"); |
322 | rio_dprintk (RIO_DEBUG_PARAM, "1 stop bit\n"); | ||
323 | Cor1 |= COR1_1STOP; | 318 | Cor1 |= COR1_1STOP; |
324 | } | 319 | } |
325 | 320 | ||
326 | if ( TtyP->termios->c_cflag & PARENB ) { | 321 | if (TtyP->termios->c_cflag & PARENB) { |
327 | rio_dprintk (RIO_DEBUG_PARAM, "Enable parity\n"); | 322 | rio_dprintk(RIO_DEBUG_PARAM, "Enable parity\n"); |
328 | Cor1 |= COR1_NORMAL; | 323 | Cor1 |= COR1_NORMAL; |
329 | } | 324 | } else { |
330 | else { | 325 | rio_dprintk(RIO_DEBUG_PARAM, "Disable parity\n"); |
331 | rio_dprintk (RIO_DEBUG_PARAM, "Disable parity\n"); | ||
332 | Cor1 |= COR1_NOP; | 326 | Cor1 |= COR1_NOP; |
333 | } | 327 | } |
334 | if ( TtyP->termios->c_cflag & PARODD ) { | 328 | if (TtyP->termios->c_cflag & PARODD) { |
335 | rio_dprintk (RIO_DEBUG_PARAM, "Odd parity\n"); | 329 | rio_dprintk(RIO_DEBUG_PARAM, "Odd parity\n"); |
336 | Cor1 |= COR1_ODD; | 330 | Cor1 |= COR1_ODD; |
337 | } | 331 | } else { |
338 | else { | 332 | rio_dprintk(RIO_DEBUG_PARAM, "Even parity\n"); |
339 | rio_dprintk (RIO_DEBUG_PARAM, "Even parity\n"); | 333 | Cor1 |= COR1_EVEN; |
340 | Cor1 |= COR1_EVEN; | ||
341 | } | 334 | } |
342 | 335 | ||
343 | /* | 336 | /* |
344 | ** COR 2 | 337 | ** COR 2 |
345 | */ | 338 | */ |
346 | if ( TtyP->termios->c_iflag & IXON ) { | 339 | if (TtyP->termios->c_iflag & IXON) { |
347 | rio_dprintk (RIO_DEBUG_PARAM, "Enable start/stop output control\n"); | 340 | rio_dprintk(RIO_DEBUG_PARAM, "Enable start/stop output control\n"); |
348 | Cor2 |= COR2_IXON; | 341 | Cor2 |= COR2_IXON; |
349 | } | 342 | } else { |
350 | else { | 343 | if (PortP->Config & RIO_IXON) { |
351 | if ( PortP->Config & RIO_IXON ) { | 344 | rio_dprintk(RIO_DEBUG_PARAM, "Force enable start/stop output control\n"); |
352 | rio_dprintk (RIO_DEBUG_PARAM, "Force enable start/stop output control\n"); | ||
353 | Cor2 |= COR2_IXON; | 345 | Cor2 |= COR2_IXON; |
354 | } | 346 | } else |
355 | else | 347 | rio_dprintk(RIO_DEBUG_PARAM, "IXON has been disabled.\n"); |
356 | rio_dprintk (RIO_DEBUG_PARAM, "IXON has been disabled.\n"); | ||
357 | } | 348 | } |
358 | 349 | ||
359 | if (TtyP->termios->c_iflag & IXANY) { | 350 | if (TtyP->termios->c_iflag & IXANY) { |
360 | if ( PortP->Config & RIO_IXANY ) { | 351 | if (PortP->Config & RIO_IXANY) { |
361 | rio_dprintk (RIO_DEBUG_PARAM, "Enable any key to restart output\n"); | 352 | rio_dprintk(RIO_DEBUG_PARAM, "Enable any key to restart output\n"); |
362 | Cor2 |= COR2_IXANY; | 353 | Cor2 |= COR2_IXANY; |
363 | } | 354 | } else |
364 | else | 355 | rio_dprintk(RIO_DEBUG_PARAM, "IXANY has been disabled due to sanity reasons.\n"); |
365 | rio_dprintk (RIO_DEBUG_PARAM, "IXANY has been disabled due to sanity reasons.\n"); | ||
366 | } | 356 | } |
367 | 357 | ||
368 | if ( TtyP->termios->c_iflag & IXOFF ) { | 358 | if (TtyP->termios->c_iflag & IXOFF) { |
369 | rio_dprintk (RIO_DEBUG_PARAM, "Enable start/stop input control 2\n"); | 359 | rio_dprintk(RIO_DEBUG_PARAM, "Enable start/stop input control 2\n"); |
370 | Cor2 |= COR2_IXOFF; | 360 | Cor2 |= COR2_IXOFF; |
371 | } | 361 | } |
372 | 362 | ||
373 | if ( TtyP->termios->c_cflag & HUPCL ) { | 363 | if (TtyP->termios->c_cflag & HUPCL) { |
374 | rio_dprintk (RIO_DEBUG_PARAM, "Hangup on last close\n"); | 364 | rio_dprintk(RIO_DEBUG_PARAM, "Hangup on last close\n"); |
375 | Cor2 |= COR2_HUPCL; | 365 | Cor2 |= COR2_HUPCL; |
376 | } | 366 | } |
377 | 367 | ||
378 | if ( C_CRTSCTS (TtyP)) { | 368 | if (C_CRTSCTS(TtyP)) { |
379 | rio_dprintk (RIO_DEBUG_PARAM, "Rx hardware flow control enabled\n"); | 369 | rio_dprintk(RIO_DEBUG_PARAM, "Rx hardware flow control enabled\n"); |
380 | Cor2 |= COR2_CTSFLOW; | 370 | Cor2 |= COR2_CTSFLOW; |
381 | Cor2 |= COR2_RTSFLOW; | 371 | Cor2 |= COR2_RTSFLOW; |
382 | } else { | 372 | } else { |
383 | rio_dprintk (RIO_DEBUG_PARAM, "Rx hardware flow control disabled\n"); | 373 | rio_dprintk(RIO_DEBUG_PARAM, "Rx hardware flow control disabled\n"); |
384 | Cor2 &= ~COR2_CTSFLOW; | 374 | Cor2 &= ~COR2_CTSFLOW; |
385 | Cor2 &= ~COR2_RTSFLOW; | 375 | Cor2 &= ~COR2_RTSFLOW; |
386 | } | 376 | } |
387 | 377 | ||
388 | 378 | ||
389 | if ( TtyP->termios->c_cflag & CLOCAL ) { | 379 | if (TtyP->termios->c_cflag & CLOCAL) { |
390 | rio_dprintk (RIO_DEBUG_PARAM, "Local line\n"); | 380 | rio_dprintk(RIO_DEBUG_PARAM, "Local line\n"); |
391 | } | 381 | } else { |
392 | else { | 382 | rio_dprintk(RIO_DEBUG_PARAM, "Possible Modem line\n"); |
393 | rio_dprintk (RIO_DEBUG_PARAM, "Possible Modem line\n"); | ||
394 | } | 383 | } |
395 | 384 | ||
396 | /* | 385 | /* |
397 | ** COR 4 (there is no COR 3) | 386 | ** COR 4 (there is no COR 3) |
398 | */ | 387 | */ |
399 | if ( TtyP->termios->c_iflag & IGNBRK ) { | 388 | if (TtyP->termios->c_iflag & IGNBRK) { |
400 | rio_dprintk (RIO_DEBUG_PARAM, "Ignore break condition\n"); | 389 | rio_dprintk(RIO_DEBUG_PARAM, "Ignore break condition\n"); |
401 | Cor4 |= COR4_IGNBRK; | 390 | Cor4 |= COR4_IGNBRK; |
402 | } | 391 | } |
403 | if ( !(TtyP->termios->c_iflag & BRKINT) ) { | 392 | if (!(TtyP->termios->c_iflag & BRKINT)) { |
404 | rio_dprintk (RIO_DEBUG_PARAM, "Break generates NULL condition\n"); | 393 | rio_dprintk(RIO_DEBUG_PARAM, "Break generates NULL condition\n"); |
405 | Cor4 |= COR4_NBRKINT; | 394 | Cor4 |= COR4_NBRKINT; |
406 | } else { | 395 | } else { |
407 | rio_dprintk (RIO_DEBUG_PARAM, "Interrupt on break condition\n"); | 396 | rio_dprintk(RIO_DEBUG_PARAM, "Interrupt on break condition\n"); |
408 | } | 397 | } |
409 | 398 | ||
410 | if ( TtyP->termios->c_iflag & INLCR ) { | 399 | if (TtyP->termios->c_iflag & INLCR) { |
411 | rio_dprintk (RIO_DEBUG_PARAM, "Map newline to carriage return on input\n"); | 400 | rio_dprintk(RIO_DEBUG_PARAM, "Map newline to carriage return on input\n"); |
412 | Cor4 |= COR4_INLCR; | 401 | Cor4 |= COR4_INLCR; |
413 | } | 402 | } |
414 | 403 | ||
415 | if ( TtyP->termios->c_iflag & IGNCR ) { | 404 | if (TtyP->termios->c_iflag & IGNCR) { |
416 | rio_dprintk (RIO_DEBUG_PARAM, "Ignore carriage return on input\n"); | 405 | rio_dprintk(RIO_DEBUG_PARAM, "Ignore carriage return on input\n"); |
417 | Cor4 |= COR4_IGNCR; | 406 | Cor4 |= COR4_IGNCR; |
418 | } | 407 | } |
419 | 408 | ||
420 | if ( TtyP->termios->c_iflag & ICRNL ) { | 409 | if (TtyP->termios->c_iflag & ICRNL) { |
421 | rio_dprintk (RIO_DEBUG_PARAM, "Map carriage return to newline on input\n"); | 410 | rio_dprintk(RIO_DEBUG_PARAM, "Map carriage return to newline on input\n"); |
422 | Cor4 |= COR4_ICRNL; | 411 | Cor4 |= COR4_ICRNL; |
423 | } | 412 | } |
424 | if ( TtyP->termios->c_iflag & IGNPAR ) { | 413 | if (TtyP->termios->c_iflag & IGNPAR) { |
425 | rio_dprintk (RIO_DEBUG_PARAM, "Ignore characters with parity errors\n"); | 414 | rio_dprintk(RIO_DEBUG_PARAM, "Ignore characters with parity errors\n"); |
426 | Cor4 |= COR4_IGNPAR; | 415 | Cor4 |= COR4_IGNPAR; |
427 | } | 416 | } |
428 | if ( TtyP->termios->c_iflag & PARMRK ) { | 417 | if (TtyP->termios->c_iflag & PARMRK) { |
429 | rio_dprintk (RIO_DEBUG_PARAM, "Mark parity errors\n"); | 418 | rio_dprintk(RIO_DEBUG_PARAM, "Mark parity errors\n"); |
430 | Cor4 |= COR4_PARMRK; | 419 | Cor4 |= COR4_PARMRK; |
431 | } | 420 | } |
432 | 421 | ||
433 | /* | 422 | /* |
434 | ** Set the RAISEMOD flag to ensure that the modem lines are raised | 423 | ** Set the RAISEMOD flag to ensure that the modem lines are raised |
435 | ** on reception of a config packet. | 424 | ** on reception of a config packet. |
436 | ** The download code handles the zero baud condition. | 425 | ** The download code handles the zero baud condition. |
437 | */ | 426 | */ |
438 | Cor4 |= COR4_RAISEMOD; | 427 | Cor4 |= COR4_RAISEMOD; |
439 | 428 | ||
440 | /* | 429 | /* |
441 | ** COR 5 | 430 | ** COR 5 |
442 | */ | 431 | */ |
443 | 432 | ||
444 | Cor5 = COR5_CMOE; | 433 | Cor5 = COR5_CMOE; |
445 | 434 | ||
446 | /* | 435 | /* |
447 | ** Set to monitor tbusy/tstop (or not). | 436 | ** Set to monitor tbusy/tstop (or not). |
448 | */ | 437 | */ |
449 | 438 | ||
450 | if (PortP->MonitorTstate) | 439 | if (PortP->MonitorTstate) |
451 | Cor5 |= COR5_TSTATE_ON; | 440 | Cor5 |= COR5_TSTATE_ON; |
@@ -453,182 +442,195 @@ int SleepFlag; | |||
453 | Cor5 |= COR5_TSTATE_OFF; | 442 | Cor5 |= COR5_TSTATE_OFF; |
454 | 443 | ||
455 | /* | 444 | /* |
456 | ** Could set LNE here if you wanted LNext processing. SVR4 will use it. | 445 | ** Could set LNE here if you wanted LNext processing. SVR4 will use it. |
457 | */ | 446 | */ |
458 | if ( TtyP->termios->c_iflag & ISTRIP ) { | 447 | if (TtyP->termios->c_iflag & ISTRIP) { |
459 | rio_dprintk (RIO_DEBUG_PARAM, "Strip input characters\n"); | 448 | rio_dprintk(RIO_DEBUG_PARAM, "Strip input characters\n"); |
460 | if (! (PortP->State & RIO_TRIAD_MODE)) { | 449 | if (!(PortP->State & RIO_TRIAD_MODE)) { |
461 | Cor5 |= COR5_ISTRIP; | 450 | Cor5 |= COR5_ISTRIP; |
462 | } | 451 | } |
463 | } | 452 | } |
464 | 453 | ||
465 | if ( TtyP->termios->c_oflag & ONLCR ) { | 454 | if (TtyP->termios->c_oflag & ONLCR) { |
466 | rio_dprintk (RIO_DEBUG_PARAM, "Map newline to carriage-return, newline on output\n"); | 455 | rio_dprintk(RIO_DEBUG_PARAM, "Map newline to carriage-return, newline on output\n"); |
467 | if ( PortP->CookMode == COOK_MEDIUM ) | 456 | if (PortP->CookMode == COOK_MEDIUM) |
468 | Cor5 |= COR5_ONLCR; | 457 | Cor5 |= COR5_ONLCR; |
469 | } | 458 | } |
470 | if ( TtyP->termios->c_oflag & OCRNL ) { | 459 | if (TtyP->termios->c_oflag & OCRNL) { |
471 | rio_dprintk (RIO_DEBUG_PARAM, "Map carriage return to newline on output\n"); | 460 | rio_dprintk(RIO_DEBUG_PARAM, "Map carriage return to newline on output\n"); |
472 | if ( PortP->CookMode == COOK_MEDIUM ) | 461 | if (PortP->CookMode == COOK_MEDIUM) |
473 | Cor5 |= COR5_OCRNL; | 462 | Cor5 |= COR5_OCRNL; |
474 | } | 463 | } |
475 | if ( ( TtyP->termios->c_oflag & TABDLY) == TAB3 ) { | 464 | if ((TtyP->termios->c_oflag & TABDLY) == TAB3) { |
476 | rio_dprintk (RIO_DEBUG_PARAM, "Tab delay 3 set\n"); | 465 | rio_dprintk(RIO_DEBUG_PARAM, "Tab delay 3 set\n"); |
477 | if ( PortP->CookMode == COOK_MEDIUM ) | 466 | if (PortP->CookMode == COOK_MEDIUM) |
478 | Cor5 |= COR5_TAB3; | 467 | Cor5 |= COR5_TAB3; |
479 | } | 468 | } |
480 | 469 | ||
481 | /* | 470 | /* |
482 | ** Flow control bytes. | 471 | ** Flow control bytes. |
483 | */ | 472 | */ |
484 | TxXon = TtyP->termios->c_cc[VSTART]; | 473 | TxXon = TtyP->termios->c_cc[VSTART]; |
485 | TxXoff = TtyP->termios->c_cc[VSTOP]; | 474 | TxXoff = TtyP->termios->c_cc[VSTOP]; |
486 | RxXon = TtyP->termios->c_cc[VSTART]; | 475 | RxXon = TtyP->termios->c_cc[VSTART]; |
487 | RxXoff = TtyP->termios->c_cc[VSTOP]; | 476 | RxXoff = TtyP->termios->c_cc[VSTOP]; |
488 | /* | 477 | /* |
489 | ** LNEXT byte | 478 | ** LNEXT byte |
490 | */ | 479 | */ |
491 | LNext = 0; | 480 | LNext = 0; |
492 | 481 | ||
493 | /* | 482 | /* |
494 | ** Baud rate bytes | 483 | ** Baud rate bytes |
495 | */ | 484 | */ |
496 | rio_dprintk (RIO_DEBUG_PARAM, "Mapping of rx/tx baud %x (%x)\n", | 485 | rio_dprintk(RIO_DEBUG_PARAM, "Mapping of rx/tx baud %x (%x)\n", TtyP->termios->c_cflag, CBAUD); |
497 | TtyP->termios->c_cflag, CBAUD); | ||
498 | 486 | ||
499 | switch (TtyP->termios->c_cflag & CBAUD) { | 487 | switch (TtyP->termios->c_cflag & CBAUD) { |
500 | #define e(b) case B ## b : RxBaud = TxBaud = RIO_B ## b ;break | 488 | #define e(b) case B ## b : RxBaud = TxBaud = RIO_B ## b ;break |
501 | e(50);e(75);e(110);e(134);e(150);e(200);e(300);e(600);e(1200); | 489 | e(50); |
502 | e(1800);e(2400);e(4800);e(9600);e(19200);e(38400);e(57600); | 490 | e(75); |
503 | e(115200); /* e(230400);e(460800); e(921600); */ | 491 | e(110); |
492 | e(134); | ||
493 | e(150); | ||
494 | e(200); | ||
495 | e(300); | ||
496 | e(600); | ||
497 | e(1200); | ||
498 | e(1800); | ||
499 | e(2400); | ||
500 | e(4800); | ||
501 | e(9600); | ||
502 | e(19200); | ||
503 | e(38400); | ||
504 | e(57600); | ||
505 | e(115200); /* e(230400);e(460800); e(921600); */ | ||
504 | } | 506 | } |
505 | 507 | ||
506 | /* XXX MIssing conversion table. XXX */ | 508 | /* XXX MIssing conversion table. XXX */ |
507 | /* (TtyP->termios->c_cflag & V_CBAUD); */ | 509 | /* (TtyP->termios->c_cflag & V_CBAUD); */ |
508 | 510 | ||
509 | rio_dprintk (RIO_DEBUG_PARAM, "tx baud 0x%x, rx baud 0x%x\n", TxBaud, RxBaud); | 511 | rio_dprintk(RIO_DEBUG_PARAM, "tx baud 0x%x, rx baud 0x%x\n", TxBaud, RxBaud); |
510 | 512 | ||
511 | 513 | ||
512 | /* | 514 | /* |
513 | ** Leftovers | 515 | ** Leftovers |
514 | */ | 516 | */ |
515 | if ( TtyP->termios->c_cflag & CREAD ) | 517 | if (TtyP->termios->c_cflag & CREAD) |
516 | rio_dprintk (RIO_DEBUG_PARAM, "Enable receiver\n"); | 518 | rio_dprintk(RIO_DEBUG_PARAM, "Enable receiver\n"); |
517 | #ifdef RCV1EN | 519 | #ifdef RCV1EN |
518 | if ( TtyP->termios->c_cflag & RCV1EN ) | 520 | if (TtyP->termios->c_cflag & RCV1EN) |
519 | rio_dprintk (RIO_DEBUG_PARAM, "RCV1EN (?)\n"); | 521 | rio_dprintk(RIO_DEBUG_PARAM, "RCV1EN (?)\n"); |
520 | #endif | 522 | #endif |
521 | #ifdef XMT1EN | 523 | #ifdef XMT1EN |
522 | if ( TtyP->termios->c_cflag & XMT1EN ) | 524 | if (TtyP->termios->c_cflag & XMT1EN) |
523 | rio_dprintk (RIO_DEBUG_PARAM, "XMT1EN (?)\n"); | 525 | rio_dprintk(RIO_DEBUG_PARAM, "XMT1EN (?)\n"); |
524 | #endif | 526 | #endif |
525 | #if 0 | 527 | #if 0 |
526 | if ( TtyP->termios->c_cflag & LOBLK ) | 528 | if (TtyP->termios->c_cflag & LOBLK) |
527 | rio_dprintk (RIO_DEBUG_PARAM, "LOBLK - JCL output blocks when not current\n"); | 529 | rio_dprintk(RIO_DEBUG_PARAM, "LOBLK - JCL output blocks when not current\n"); |
528 | #endif | 530 | #endif |
529 | if ( TtyP->termios->c_lflag & ISIG ) | 531 | if (TtyP->termios->c_lflag & ISIG) |
530 | rio_dprintk (RIO_DEBUG_PARAM, "Input character signal generating enabled\n"); | 532 | rio_dprintk(RIO_DEBUG_PARAM, "Input character signal generating enabled\n"); |
531 | if ( TtyP->termios->c_lflag & ICANON ) | 533 | if (TtyP->termios->c_lflag & ICANON) |
532 | rio_dprintk (RIO_DEBUG_PARAM, "Canonical input: erase and kill enabled\n"); | 534 | rio_dprintk(RIO_DEBUG_PARAM, "Canonical input: erase and kill enabled\n"); |
533 | if ( TtyP->termios->c_lflag & XCASE ) | 535 | if (TtyP->termios->c_lflag & XCASE) |
534 | rio_dprintk (RIO_DEBUG_PARAM, "Canonical upper/lower presentation\n"); | 536 | rio_dprintk(RIO_DEBUG_PARAM, "Canonical upper/lower presentation\n"); |
535 | if ( TtyP->termios->c_lflag & ECHO ) | 537 | if (TtyP->termios->c_lflag & ECHO) |
536 | rio_dprintk (RIO_DEBUG_PARAM, "Enable input echo\n"); | 538 | rio_dprintk(RIO_DEBUG_PARAM, "Enable input echo\n"); |
537 | if ( TtyP->termios->c_lflag & ECHOE ) | 539 | if (TtyP->termios->c_lflag & ECHOE) |
538 | rio_dprintk (RIO_DEBUG_PARAM, "Enable echo erase\n"); | 540 | rio_dprintk(RIO_DEBUG_PARAM, "Enable echo erase\n"); |
539 | if ( TtyP->termios->c_lflag & ECHOK ) | 541 | if (TtyP->termios->c_lflag & ECHOK) |
540 | rio_dprintk (RIO_DEBUG_PARAM, "Enable echo kill\n"); | 542 | rio_dprintk(RIO_DEBUG_PARAM, "Enable echo kill\n"); |
541 | if ( TtyP->termios->c_lflag & ECHONL ) | 543 | if (TtyP->termios->c_lflag & ECHONL) |
542 | rio_dprintk (RIO_DEBUG_PARAM, "Enable echo newline\n"); | 544 | rio_dprintk(RIO_DEBUG_PARAM, "Enable echo newline\n"); |
543 | if ( TtyP->termios->c_lflag & NOFLSH ) | 545 | if (TtyP->termios->c_lflag & NOFLSH) |
544 | rio_dprintk (RIO_DEBUG_PARAM, "Disable flush after interrupt or quit\n"); | 546 | rio_dprintk(RIO_DEBUG_PARAM, "Disable flush after interrupt or quit\n"); |
545 | #ifdef TOSTOP | 547 | #ifdef TOSTOP |
546 | if ( TtyP->termios->c_lflag & TOSTOP ) | 548 | if (TtyP->termios->c_lflag & TOSTOP) |
547 | rio_dprintk (RIO_DEBUG_PARAM, "Send SIGTTOU for background output\n"); | 549 | rio_dprintk(RIO_DEBUG_PARAM, "Send SIGTTOU for background output\n"); |
548 | #endif | 550 | #endif |
549 | #ifdef XCLUDE | 551 | #ifdef XCLUDE |
550 | if ( TtyP->termios->c_lflag & XCLUDE ) | 552 | if (TtyP->termios->c_lflag & XCLUDE) |
551 | rio_dprintk (RIO_DEBUG_PARAM, "Exclusive use of this line\n"); | 553 | rio_dprintk(RIO_DEBUG_PARAM, "Exclusive use of this line\n"); |
552 | #endif | 554 | #endif |
553 | if ( TtyP->termios->c_iflag & IUCLC ) | 555 | if (TtyP->termios->c_iflag & IUCLC) |
554 | rio_dprintk (RIO_DEBUG_PARAM, "Map uppercase to lowercase on input\n"); | 556 | rio_dprintk(RIO_DEBUG_PARAM, "Map uppercase to lowercase on input\n"); |
555 | if ( TtyP->termios->c_oflag & OPOST ) | 557 | if (TtyP->termios->c_oflag & OPOST) |
556 | rio_dprintk (RIO_DEBUG_PARAM, "Enable output post-processing\n"); | 558 | rio_dprintk(RIO_DEBUG_PARAM, "Enable output post-processing\n"); |
557 | if ( TtyP->termios->c_oflag & OLCUC ) | 559 | if (TtyP->termios->c_oflag & OLCUC) |
558 | rio_dprintk (RIO_DEBUG_PARAM, "Map lowercase to uppercase on output\n"); | 560 | rio_dprintk(RIO_DEBUG_PARAM, "Map lowercase to uppercase on output\n"); |
559 | if ( TtyP->termios->c_oflag & ONOCR ) | 561 | if (TtyP->termios->c_oflag & ONOCR) |
560 | rio_dprintk (RIO_DEBUG_PARAM, "No carriage return output at column 0\n"); | 562 | rio_dprintk(RIO_DEBUG_PARAM, "No carriage return output at column 0\n"); |
561 | if ( TtyP->termios->c_oflag & ONLRET ) | 563 | if (TtyP->termios->c_oflag & ONLRET) |
562 | rio_dprintk (RIO_DEBUG_PARAM, "Newline performs carriage return function\n"); | 564 | rio_dprintk(RIO_DEBUG_PARAM, "Newline performs carriage return function\n"); |
563 | if ( TtyP->termios->c_oflag & OFILL ) | 565 | if (TtyP->termios->c_oflag & OFILL) |
564 | rio_dprintk (RIO_DEBUG_PARAM, "Use fill characters for delay\n"); | 566 | rio_dprintk(RIO_DEBUG_PARAM, "Use fill characters for delay\n"); |
565 | if ( TtyP->termios->c_oflag & OFDEL ) | 567 | if (TtyP->termios->c_oflag & OFDEL) |
566 | rio_dprintk (RIO_DEBUG_PARAM, "Fill character is DEL\n"); | 568 | rio_dprintk(RIO_DEBUG_PARAM, "Fill character is DEL\n"); |
567 | if ( TtyP->termios->c_oflag & NLDLY ) | 569 | if (TtyP->termios->c_oflag & NLDLY) |
568 | rio_dprintk (RIO_DEBUG_PARAM, "Newline delay set\n"); | 570 | rio_dprintk(RIO_DEBUG_PARAM, "Newline delay set\n"); |
569 | if ( TtyP->termios->c_oflag & CRDLY ) | 571 | if (TtyP->termios->c_oflag & CRDLY) |
570 | rio_dprintk (RIO_DEBUG_PARAM, "Carriage return delay set\n"); | 572 | rio_dprintk(RIO_DEBUG_PARAM, "Carriage return delay set\n"); |
571 | if ( TtyP->termios->c_oflag & TABDLY ) | 573 | if (TtyP->termios->c_oflag & TABDLY) |
572 | rio_dprintk (RIO_DEBUG_PARAM, "Tab delay set\n"); | 574 | rio_dprintk(RIO_DEBUG_PARAM, "Tab delay set\n"); |
573 | #if 0 | 575 | #if 0 |
574 | if ( TtyP->termios->c_oflag & BSDLY ) | 576 | if (TtyP->termios->c_oflag & BSDLY) |
575 | rio_dprintk (RIO_DEBUG_PARAM, "Back-space delay set\n"); | 577 | rio_dprintk(RIO_DEBUG_PARAM, "Back-space delay set\n"); |
576 | if ( TtyP->termios->c_oflag & VTDLY ) | 578 | if (TtyP->termios->c_oflag & VTDLY) |
577 | rio_dprintk (RIO_DEBUG_PARAM, "Vertical tab delay set\n"); | 579 | rio_dprintk(RIO_DEBUG_PARAM, "Vertical tab delay set\n"); |
578 | if ( TtyP->termios->c_oflag & FFDLY ) | 580 | if (TtyP->termios->c_oflag & FFDLY) |
579 | rio_dprintk (RIO_DEBUG_PARAM, "Form-feed delay set\n"); | 581 | rio_dprintk(RIO_DEBUG_PARAM, "Form-feed delay set\n"); |
580 | #endif | 582 | #endif |
581 | /* | 583 | /* |
582 | ** These things are kind of useful in a later life! | 584 | ** These things are kind of useful in a later life! |
583 | */ | 585 | */ |
584 | PortP->Cor2Copy = Cor2; | 586 | PortP->Cor2Copy = Cor2; |
585 | 587 | ||
586 | if ( PortP->State & RIO_DELETED ) { | 588 | if (PortP->State & RIO_DELETED) { |
587 | rio_spin_unlock_irqrestore( &PortP->portSem, flags); | 589 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); |
588 | func_exit (); | 590 | func_exit(); |
589 | 591 | ||
590 | return RIO_FAIL; | 592 | return RIO_FAIL; |
591 | } | 593 | } |
592 | 594 | ||
593 | /* | 595 | /* |
594 | ** Actually write the info into the packet to be sent | 596 | ** Actually write the info into the packet to be sent |
595 | */ | 597 | */ |
596 | WBYTE(phb_param_ptr->Cmd, cmd); | 598 | WBYTE(phb_param_ptr->Cmd, cmd); |
597 | WBYTE(phb_param_ptr->Cor1, Cor1); | 599 | WBYTE(phb_param_ptr->Cor1, Cor1); |
598 | WBYTE(phb_param_ptr->Cor2, Cor2); | 600 | WBYTE(phb_param_ptr->Cor2, Cor2); |
599 | WBYTE(phb_param_ptr->Cor4, Cor4); | 601 | WBYTE(phb_param_ptr->Cor4, Cor4); |
600 | WBYTE(phb_param_ptr->Cor5, Cor5); | 602 | WBYTE(phb_param_ptr->Cor5, Cor5); |
601 | WBYTE(phb_param_ptr->TxXon, TxXon); | 603 | WBYTE(phb_param_ptr->TxXon, TxXon); |
602 | WBYTE(phb_param_ptr->RxXon, RxXon); | 604 | WBYTE(phb_param_ptr->RxXon, RxXon); |
603 | WBYTE(phb_param_ptr->TxXoff, TxXoff); | 605 | WBYTE(phb_param_ptr->TxXoff, TxXoff); |
604 | WBYTE(phb_param_ptr->RxXoff, RxXoff); | 606 | WBYTE(phb_param_ptr->RxXoff, RxXoff); |
605 | WBYTE(phb_param_ptr->LNext, LNext); | 607 | WBYTE(phb_param_ptr->LNext, LNext); |
606 | WBYTE(phb_param_ptr->TxBaud, TxBaud); | 608 | WBYTE(phb_param_ptr->TxBaud, TxBaud); |
607 | WBYTE(phb_param_ptr->RxBaud, RxBaud); | 609 | WBYTE(phb_param_ptr->RxBaud, RxBaud); |
608 | 610 | ||
609 | /* | 611 | /* |
610 | ** Set the length/command field | 612 | ** Set the length/command field |
611 | */ | 613 | */ |
612 | WBYTE(PacketP->len , 12 | PKT_CMD_BIT); | 614 | WBYTE(PacketP->len, 12 | PKT_CMD_BIT); |
613 | 615 | ||
614 | /* | 616 | /* |
615 | ** The packet is formed - now, whack it off | 617 | ** The packet is formed - now, whack it off |
616 | ** to its final destination: | 618 | ** to its final destination: |
617 | */ | 619 | */ |
618 | add_transmit(PortP); | 620 | add_transmit(PortP); |
619 | /* | 621 | /* |
620 | ** Count characters transmitted for port statistics reporting | 622 | ** Count characters transmitted for port statistics reporting |
621 | */ | 623 | */ |
622 | if (PortP->statsGather) | 624 | if (PortP->statsGather) |
623 | PortP->txchars += 12; | 625 | PortP->txchars += 12; |
624 | 626 | ||
625 | rio_spin_unlock_irqrestore( &PortP->portSem, flags); | 627 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); |
626 | 628 | ||
627 | rio_dprintk (RIO_DEBUG_PARAM, "add_transmit returned.\n"); | 629 | rio_dprintk(RIO_DEBUG_PARAM, "add_transmit returned.\n"); |
628 | /* | 630 | /* |
629 | ** job done. | 631 | ** job done. |
630 | */ | 632 | */ |
631 | func_exit (); | 633 | func_exit(); |
632 | 634 | ||
633 | return RIO_SUCCESS; | 635 | return RIO_SUCCESS; |
634 | } | 636 | } |
@@ -638,16 +640,15 @@ int SleepFlag; | |||
638 | ** We can add another packet to a transmit queue if the packet pointer pointed | 640 | ** We can add another packet to a transmit queue if the packet pointer pointed |
639 | ** to by the TxAdd pointer has PKT_IN_USE clear in its address. | 641 | ** to by the TxAdd pointer has PKT_IN_USE clear in its address. |
640 | */ | 642 | */ |
641 | int | 643 | int can_add_transmit(PktP, PortP) |
642 | can_add_transmit(PktP, PortP) | ||
643 | PKT **PktP; | 644 | PKT **PktP; |
644 | struct Port *PortP; | 645 | struct Port *PortP; |
645 | { | 646 | { |
646 | register PKT *tp; | 647 | register PKT *tp; |
647 | 648 | ||
648 | *PktP = tp = (PKT *)RIO_PTR(PortP->Caddr,RWORD(*PortP->TxAdd)); | 649 | *PktP = tp = (PKT *) RIO_PTR(PortP->Caddr, RWORD(*PortP->TxAdd)); |
649 | 650 | ||
650 | return !((uint)tp & PKT_IN_USE); | 651 | return !((uint) tp & PKT_IN_USE); |
651 | } | 652 | } |
652 | 653 | ||
653 | /* | 654 | /* |
@@ -655,25 +656,22 @@ struct Port *PortP; | |||
655 | ** and then move the TxAdd pointer along one position to point to the next | 656 | ** and then move the TxAdd pointer along one position to point to the next |
656 | ** packet pointer. You must wrap the pointer from the end back to the start. | 657 | ** packet pointer. You must wrap the pointer from the end back to the start. |
657 | */ | 658 | */ |
658 | void | 659 | void add_transmit(PortP) |
659 | add_transmit(PortP) | 660 | struct Port *PortP; |
660 | struct Port *PortP; | ||
661 | { | 661 | { |
662 | if (RWORD(*PortP->TxAdd) & PKT_IN_USE) { | 662 | if (RWORD(*PortP->TxAdd) & PKT_IN_USE) { |
663 | rio_dprintk (RIO_DEBUG_PARAM, "add_transmit: Packet has been stolen!"); | 663 | rio_dprintk(RIO_DEBUG_PARAM, "add_transmit: Packet has been stolen!"); |
664 | } | 664 | } |
665 | WWORD( *(ushort *)PortP->TxAdd, RWORD(*PortP->TxAdd) | PKT_IN_USE); | 665 | WWORD(*(ushort *) PortP->TxAdd, RWORD(*PortP->TxAdd) | PKT_IN_USE); |
666 | PortP->TxAdd = (PortP->TxAdd == PortP->TxEnd) ? PortP->TxStart : | 666 | PortP->TxAdd = (PortP->TxAdd == PortP->TxEnd) ? PortP->TxStart : PortP->TxAdd + 1; |
667 | PortP->TxAdd + 1; | 667 | WWORD(PortP->PhbP->tx_add, RIO_OFF(PortP->Caddr, PortP->TxAdd)); |
668 | WWORD( PortP->PhbP->tx_add , RIO_OFF(PortP->Caddr,PortP->TxAdd) ); | ||
669 | } | 668 | } |
670 | 669 | ||
671 | /**************************************** | 670 | /**************************************** |
672 | * Put a packet onto the end of the | 671 | * Put a packet onto the end of the |
673 | * free list | 672 | * free list |
674 | ****************************************/ | 673 | ****************************************/ |
675 | void | 674 | void put_free_end(HostP, PktP) |
676 | put_free_end(HostP, PktP) | ||
677 | struct Host *HostP; | 675 | struct Host *HostP; |
678 | PKT *PktP; | 676 | PKT *PktP; |
679 | { | 677 | { |
@@ -688,24 +686,23 @@ PKT *PktP; | |||
688 | * | 686 | * |
689 | ************************************************/ | 687 | ************************************************/ |
690 | 688 | ||
691 | rio_dprintk (RIO_DEBUG_PFE, "put_free_end(PktP=%x)\n",(int)PktP); | 689 | rio_dprintk(RIO_DEBUG_PFE, "put_free_end(PktP=%x)\n", (int) PktP); |
692 | 690 | ||
693 | if ((old_end=RWORD(HostP->ParmMapP->free_list_end)) != TPNULL) { | 691 | if ((old_end = RWORD(HostP->ParmMapP->free_list_end)) != TPNULL) { |
694 | new_end = RIO_OFF(HostP->Caddr,PktP); | 692 | new_end = RIO_OFF(HostP->Caddr, PktP); |
695 | tmp_pointer = (FREE_LIST *)RIO_PTR(HostP->Caddr,old_end); | 693 | tmp_pointer = (FREE_LIST *) RIO_PTR(HostP->Caddr, old_end); |
696 | WWORD(tmp_pointer->next , new_end ); | 694 | WWORD(tmp_pointer->next, new_end); |
697 | WWORD(((FREE_LIST *)PktP)->prev , old_end); | 695 | WWORD(((FREE_LIST *) PktP)->prev, old_end); |
698 | WWORD(((FREE_LIST *)PktP)->next , TPNULL); | 696 | WWORD(((FREE_LIST *) PktP)->next, TPNULL); |
699 | WWORD(HostP->ParmMapP->free_list_end, new_end); | 697 | WWORD(HostP->ParmMapP->free_list_end, new_end); |
700 | } | 698 | } else { /* First packet on the free list this should never happen! */ |
701 | else { /* First packet on the free list this should never happen! */ | 699 | rio_dprintk(RIO_DEBUG_PFE, "put_free_end(): This should never happen\n"); |
702 | rio_dprintk (RIO_DEBUG_PFE, "put_free_end(): This should never happen\n"); | 700 | WWORD(HostP->ParmMapP->free_list_end, RIO_OFF(HostP->Caddr, PktP)); |
703 | WWORD(HostP->ParmMapP->free_list_end , RIO_OFF(HostP->Caddr,PktP)); | 701 | tmp_pointer = (FREE_LIST *) PktP; |
704 | tmp_pointer = (FREE_LIST *)PktP; | 702 | WWORD(tmp_pointer->prev, TPNULL); |
705 | WWORD(tmp_pointer->prev , TPNULL); | 703 | WWORD(tmp_pointer->next, TPNULL); |
706 | WWORD(tmp_pointer->next , TPNULL); | 704 | } |
707 | } | 705 | rio_dprintk(RIO_DEBUG_CMD, "Before unlock: %p\n", &HostP->HostLock); |
708 | rio_dprintk (RIO_DEBUG_CMD, "Before unlock: %p\n", &HostP->HostLock); | ||
709 | rio_spin_unlock_irqrestore(&HostP->HostLock, flags); | 706 | rio_spin_unlock_irqrestore(&HostP->HostLock, flags); |
710 | } | 707 | } |
711 | 708 | ||
@@ -715,14 +712,12 @@ PKT *PktP; | |||
715 | ** relevant packet, [having cleared the PKT_IN_USE bit]. If PKT_IN_USE is clear, | 712 | ** relevant packet, [having cleared the PKT_IN_USE bit]. If PKT_IN_USE is clear, |
716 | ** then can_remove_receive() returns 0. | 713 | ** then can_remove_receive() returns 0. |
717 | */ | 714 | */ |
718 | int | 715 | int can_remove_receive(PktP, PortP) |
719 | can_remove_receive(PktP, PortP) | ||
720 | PKT **PktP; | 716 | PKT **PktP; |
721 | struct Port *PortP; | 717 | struct Port *PortP; |
722 | { | 718 | { |
723 | if ( RWORD(*PortP->RxRemove) & PKT_IN_USE) { | 719 | if (RWORD(*PortP->RxRemove) & PKT_IN_USE) { |
724 | *PktP = (PKT *)RIO_PTR(PortP->Caddr, | 720 | *PktP = (PKT *) RIO_PTR(PortP->Caddr, RWORD(*PortP->RxRemove) & ~PKT_IN_USE); |
725 | RWORD(*PortP->RxRemove) & ~PKT_IN_USE); | ||
726 | return 1; | 721 | return 1; |
727 | } | 722 | } |
728 | return 0; | 723 | return 0; |
@@ -733,12 +728,10 @@ struct Port *PortP; | |||
733 | ** and then bump the pointers. Once the pointers get to the end, they must | 728 | ** and then bump the pointers. Once the pointers get to the end, they must |
734 | ** be wrapped back to the start. | 729 | ** be wrapped back to the start. |
735 | */ | 730 | */ |
736 | void | 731 | void remove_receive(PortP) |
737 | remove_receive(PortP) | 732 | struct Port *PortP; |
738 | struct Port *PortP; | ||
739 | { | 733 | { |
740 | WWORD( *PortP->RxRemove, RWORD(*PortP->RxRemove) & ~PKT_IN_USE ); | 734 | WWORD(*PortP->RxRemove, RWORD(*PortP->RxRemove) & ~PKT_IN_USE); |
741 | PortP->RxRemove = (PortP->RxRemove == PortP->RxEnd) ? PortP->RxStart : | 735 | PortP->RxRemove = (PortP->RxRemove == PortP->RxEnd) ? PortP->RxStart : PortP->RxRemove + 1; |
742 | PortP->RxRemove + 1; | 736 | WWORD(PortP->PhbP->rx_remove, RIO_OFF(PortP->Caddr, PortP->RxRemove)); |
743 | WWORD( PortP->PhbP->rx_remove , RIO_OFF(PortP->Caddr, PortP->RxRemove) ); | ||
744 | } | 737 | } |
diff --git a/drivers/char/rio/riopcicopy.c b/drivers/char/rio/riopcicopy.c index 2ea99a60aa32..535afaa51ca5 100644 --- a/drivers/char/rio/riopcicopy.c +++ b/drivers/char/rio/riopcicopy.c | |||
@@ -1,8 +1,8 @@ | |||
1 | 1 | ||
2 | /* Yeah. We have copyright on this one. Sure. */ | 2 | /* Yeah. We have copyright on this one. Sure. */ |
3 | 3 | ||
4 | void rio_pcicopy( char *from, char *to, int amount) | 4 | void rio_pcicopy(char *from, char *to, int amount) |
5 | { | 5 | { |
6 | while ( amount-- ) | 6 | while (amount--) |
7 | *to++ = *from++; | 7 | *to++ = *from++; |
8 | } | 8 | } |
diff --git a/drivers/char/rio/rioroute.c b/drivers/char/rio/rioroute.c index e9564c9fb37c..0f4cd33ba641 100644 --- a/drivers/char/rio/rioroute.c +++ b/drivers/char/rio/rioroute.c | |||
@@ -93,625 +93,517 @@ static void RIOConCon(struct rio_info *, struct Host *, uint, uint, uint, uint, | |||
93 | ** Incoming on the ROUTE_RUP | 93 | ** Incoming on the ROUTE_RUP |
94 | ** I wrote this while I was tired. Forgive me. | 94 | ** I wrote this while I was tired. Forgive me. |
95 | */ | 95 | */ |
96 | int RIORouteRup( struct rio_info *p, uint Rup, struct Host *HostP, PKT *PacketP ) | 96 | int RIORouteRup(struct rio_info *p, uint Rup, struct Host *HostP, PKT * PacketP) |
97 | { | 97 | { |
98 | struct PktCmd *PktCmdP = (struct PktCmd *)PacketP->data; | 98 | struct PktCmd *PktCmdP = (struct PktCmd *) PacketP->data; |
99 | struct PktCmd_M *PktReplyP; | 99 | struct PktCmd_M *PktReplyP; |
100 | struct CmdBlk *CmdBlkP; | 100 | struct CmdBlk *CmdBlkP; |
101 | struct Port *PortP; | 101 | struct Port *PortP; |
102 | struct Map *MapP; | 102 | struct Map *MapP; |
103 | struct Top *TopP; | 103 | struct Top *TopP; |
104 | int ThisLink, ThisLinkMin, ThisLinkMax; | 104 | int ThisLink, ThisLinkMin, ThisLinkMax; |
105 | int port; | 105 | int port; |
106 | int Mod, Mod1, Mod2; | 106 | int Mod, Mod1, Mod2; |
107 | ushort RtaType; | 107 | ushort RtaType; |
108 | uint RtaUniq; | 108 | uint RtaUniq; |
109 | uint ThisUnit, ThisUnit2; /* 2 ids to accommodate 16 port RTA */ | 109 | uint ThisUnit, ThisUnit2; /* 2 ids to accommodate 16 port RTA */ |
110 | uint OldUnit, NewUnit, OldLink, NewLink; | 110 | uint OldUnit, NewUnit, OldLink, NewLink; |
111 | char *MyType, *MyName; | 111 | char *MyType, *MyName; |
112 | int Lies; | 112 | int Lies; |
113 | unsigned long flags; | 113 | unsigned long flags; |
114 | 114 | ||
115 | #ifdef STACK | 115 | #ifdef STACK |
116 | RIOStackCheck("RIORouteRup"); | 116 | RIOStackCheck("RIORouteRup"); |
117 | #endif | 117 | #endif |
118 | #ifdef CHECK | 118 | #ifdef CHECK |
119 | CheckPacketP(PacketP); | 119 | CheckPacketP(PacketP); |
120 | CheckHostP(HostP); | 120 | CheckHostP(HostP); |
121 | CheckRup(Rup); | 121 | CheckRup(Rup); |
122 | CheckHost(Host); | 122 | CheckHost(Host); |
123 | #endif | 123 | #endif |
124 | /* | ||
125 | ** Is this unit telling us it's current link topology? | ||
126 | */ | ||
127 | if ( RBYTE(PktCmdP->Command) == ROUTE_TOPOLOGY ) | ||
128 | { | ||
129 | MapP = HostP->Mapping; | ||
130 | |||
131 | /* | ||
132 | ** The packet can be sent either by the host or by an RTA. | ||
133 | ** If it comes from the host, then we need to fill in the | ||
134 | ** Topology array in the host structure. If it came in | ||
135 | ** from an RTA then we need to fill in the Mapping structure's | ||
136 | ** Topology array for the unit. | ||
137 | */ | ||
138 | if ( Rup >= (ushort)MAX_RUP ) | ||
139 | { | ||
140 | ThisUnit = HOST_ID; | ||
141 | TopP = HostP->Topology; | ||
142 | MyType = "Host"; | ||
143 | MyName = HostP->Name; | ||
144 | ThisLinkMin = ThisLinkMax = Rup - MAX_RUP; | ||
145 | } | ||
146 | else | ||
147 | { | ||
148 | ThisUnit = Rup+1; | ||
149 | TopP = HostP->Mapping[Rup].Topology; | ||
150 | MyType = "RTA"; | ||
151 | MyName = HostP->Mapping[Rup].Name; | ||
152 | ThisLinkMin = 0; | ||
153 | ThisLinkMax = LINKS_PER_UNIT - 1; | ||
154 | } | ||
155 | |||
156 | /* | ||
157 | ** Lies will not be tolerated. | ||
158 | ** If any pair of links claim to be connected to the same | ||
159 | ** place, then ignore this packet completely. | ||
160 | */ | ||
161 | Lies = 0; | ||
162 | for ( ThisLink=ThisLinkMin + 1; ThisLink <= ThisLinkMax; ThisLink++) | ||
163 | { | ||
164 | /* | ||
165 | ** it won't lie about network interconnect, total disconnects | ||
166 | ** and no-IDs. (or at least, it doesn't *matter* if it does) | ||
167 | */ | ||
168 | if ( RBYTE(PktCmdP->RouteTopology[ThisLink].Unit) > (ushort)MAX_RUP ) | ||
169 | continue; | ||
170 | |||
171 | for ( NewLink=ThisLinkMin; NewLink < ThisLink; NewLink++ ) | ||
172 | { | ||
173 | if ( (RBYTE(PktCmdP->RouteTopology[ThisLink].Unit) == | ||
174 | RBYTE(PktCmdP->RouteTopology[NewLink].Unit)) && | ||
175 | (RBYTE(PktCmdP->RouteTopology[ThisLink].Link) == | ||
176 | RBYTE(PktCmdP->RouteTopology[NewLink].Link)) ) | ||
177 | { | ||
178 | Lies++; | ||
179 | } | ||
180 | } | ||
181 | } | ||
182 | |||
183 | if ( Lies ) | ||
184 | { | ||
185 | rio_dprintk (RIO_DEBUG_ROUTE, "LIES! DAMN LIES! %d LIES!\n",Lies); | ||
186 | rio_dprintk (RIO_DEBUG_ROUTE, "%d:%c %d:%c %d:%c %d:%c\n", | ||
187 | RBYTE(PktCmdP->RouteTopology[0].Unit), | ||
188 | 'A'+RBYTE(PktCmdP->RouteTopology[0].Link), | ||
189 | RBYTE(PktCmdP->RouteTopology[1].Unit), | ||
190 | 'A'+RBYTE(PktCmdP->RouteTopology[1].Link), | ||
191 | RBYTE(PktCmdP->RouteTopology[2].Unit), | ||
192 | 'A'+RBYTE(PktCmdP->RouteTopology[2].Link), | ||
193 | RBYTE(PktCmdP->RouteTopology[3].Unit), | ||
194 | 'A'+RBYTE(PktCmdP->RouteTopology[3].Link)); | ||
195 | return TRUE; | ||
196 | } | ||
197 | |||
198 | /* | ||
199 | ** now, process each link. | ||
200 | */ | ||
201 | for ( ThisLink=ThisLinkMin; ThisLink <= ThisLinkMax; ThisLink++) | ||
202 | { | ||
203 | /* | ||
204 | ** this is what it was connected to | ||
205 | */ | ||
206 | OldUnit = TopP[ThisLink].Unit; | ||
207 | OldLink = TopP[ThisLink].Link; | ||
208 | |||
209 | /* | ||
210 | ** this is what it is now connected to | ||
211 | */ | ||
212 | NewUnit = RBYTE(PktCmdP->RouteTopology[ThisLink].Unit); | ||
213 | NewLink = RBYTE(PktCmdP->RouteTopology[ThisLink].Link); | ||
214 | |||
215 | if ( OldUnit != NewUnit || OldLink != NewLink ) | ||
216 | { | ||
217 | /* | 124 | /* |
218 | ** something has changed! | 125 | ** Is this unit telling us it's current link topology? |
219 | */ | 126 | */ |
220 | 127 | if (RBYTE(PktCmdP->Command) == ROUTE_TOPOLOGY) { | |
221 | if ( NewUnit > MAX_RUP && | 128 | MapP = HostP->Mapping; |
222 | NewUnit != ROUTE_DISCONNECT && | 129 | |
223 | NewUnit != ROUTE_NO_ID && | 130 | /* |
224 | NewUnit != ROUTE_INTERCONNECT ) | 131 | ** The packet can be sent either by the host or by an RTA. |
225 | { | 132 | ** If it comes from the host, then we need to fill in the |
226 | rio_dprintk (RIO_DEBUG_ROUTE, "I have a link from %s %s to unit %d:%d - I don't like it.\n", | 133 | ** Topology array in the host structure. If it came in |
227 | MyType, | 134 | ** from an RTA then we need to fill in the Mapping structure's |
228 | MyName, | 135 | ** Topology array for the unit. |
229 | NewUnit, | 136 | */ |
230 | NewLink); | 137 | if (Rup >= (ushort) MAX_RUP) { |
231 | } | 138 | ThisUnit = HOST_ID; |
232 | else | 139 | TopP = HostP->Topology; |
233 | { | 140 | MyType = "Host"; |
234 | /* | 141 | MyName = HostP->Name; |
235 | ** put the new values in | 142 | ThisLinkMin = ThisLinkMax = Rup - MAX_RUP; |
236 | */ | 143 | } else { |
237 | TopP[ThisLink].Unit = NewUnit; | 144 | ThisUnit = Rup + 1; |
238 | TopP[ThisLink].Link = NewLink; | 145 | TopP = HostP->Mapping[Rup].Topology; |
239 | 146 | MyType = "RTA"; | |
240 | RIOSetChange(p); | 147 | MyName = HostP->Mapping[Rup].Name; |
241 | 148 | ThisLinkMin = 0; | |
242 | if ( OldUnit <= MAX_RUP ) | 149 | ThisLinkMax = LINKS_PER_UNIT - 1; |
243 | { | 150 | } |
244 | /* | 151 | |
245 | ** If something has become bust, then re-enable them messages | 152 | /* |
246 | */ | 153 | ** Lies will not be tolerated. |
247 | if (! p->RIONoMessage) | 154 | ** If any pair of links claim to be connected to the same |
248 | RIOConCon(p,HostP,ThisUnit,ThisLink,OldUnit,OldLink,DISCONNECT); | 155 | ** place, then ignore this packet completely. |
249 | } | 156 | */ |
250 | 157 | Lies = 0; | |
251 | if ( ( NewUnit <= MAX_RUP ) && !p->RIONoMessage ) | 158 | for (ThisLink = ThisLinkMin + 1; ThisLink <= ThisLinkMax; ThisLink++) { |
252 | RIOConCon(p,HostP,ThisUnit,ThisLink,NewUnit,NewLink,CONNECT); | 159 | /* |
253 | 160 | ** it won't lie about network interconnect, total disconnects | |
254 | if ( NewUnit == ROUTE_NO_ID ) | 161 | ** and no-IDs. (or at least, it doesn't *matter* if it does) |
255 | rio_dprintk (RIO_DEBUG_ROUTE, "%s %s (%c) is connected to an unconfigured unit.\n", | 162 | */ |
256 | MyType,MyName,'A'+ThisLink); | 163 | if (RBYTE(PktCmdP->RouteTopology[ThisLink].Unit) > (ushort) MAX_RUP) |
257 | 164 | continue; | |
258 | if ( NewUnit == ROUTE_INTERCONNECT ) | 165 | |
259 | { | 166 | for (NewLink = ThisLinkMin; NewLink < ThisLink; NewLink++) { |
260 | if (! p->RIONoMessage) | 167 | if ((RBYTE(PktCmdP->RouteTopology[ThisLink].Unit) == RBYTE(PktCmdP->RouteTopology[NewLink].Unit)) && (RBYTE(PktCmdP->RouteTopology[ThisLink].Link) == RBYTE(PktCmdP->RouteTopology[NewLink].Link))) { |
261 | cprintf("%s '%s' (%c) is connected to another network.\n", MyType,MyName,'A'+ThisLink); | 168 | Lies++; |
262 | } | 169 | } |
263 | 170 | } | |
264 | /* | 171 | } |
265 | ** perform an update for 'the other end', so that these messages | 172 | |
266 | ** only appears once. Only disconnect the other end if it is pointing | 173 | if (Lies) { |
267 | ** at us! | 174 | rio_dprintk(RIO_DEBUG_ROUTE, "LIES! DAMN LIES! %d LIES!\n", Lies); |
268 | */ | 175 | rio_dprintk(RIO_DEBUG_ROUTE, "%d:%c %d:%c %d:%c %d:%c\n", |
269 | if ( OldUnit == HOST_ID ) | 176 | RBYTE(PktCmdP->RouteTopology[0].Unit), |
270 | { | 177 | 'A' + RBYTE(PktCmdP->RouteTopology[0].Link), |
271 | if ( HostP->Topology[OldLink].Unit == ThisUnit && | 178 | RBYTE(PktCmdP->RouteTopology[1].Unit), |
272 | HostP->Topology[OldLink].Link == ThisLink ) | 179 | 'A' + RBYTE(PktCmdP->RouteTopology[1].Link), RBYTE(PktCmdP->RouteTopology[2].Unit), 'A' + RBYTE(PktCmdP->RouteTopology[2].Link), RBYTE(PktCmdP->RouteTopology[3].Unit), 'A' + RBYTE(PktCmdP->RouteTopology[3].Link)); |
273 | { | 180 | return TRUE; |
274 | rio_dprintk (RIO_DEBUG_ROUTE, "SETTING HOST (%c) TO DISCONNECTED!\n", OldLink+'A'); | 181 | } |
275 | HostP->Topology[OldLink].Unit = ROUTE_DISCONNECT; | 182 | |
276 | HostP->Topology[OldLink].Link = NO_LINK; | 183 | /* |
277 | } | 184 | ** now, process each link. |
278 | else | 185 | */ |
279 | { | 186 | for (ThisLink = ThisLinkMin; ThisLink <= ThisLinkMax; ThisLink++) { |
280 | rio_dprintk (RIO_DEBUG_ROUTE, "HOST(%c) WAS NOT CONNECTED TO %s (%c)!\n", | 187 | /* |
281 | OldLink+'A',HostP->Mapping[ThisUnit-1].Name,ThisLink+'A'); | 188 | ** this is what it was connected to |
282 | } | 189 | */ |
283 | } | 190 | OldUnit = TopP[ThisLink].Unit; |
284 | else if ( OldUnit <= MAX_RUP ) | 191 | OldLink = TopP[ThisLink].Link; |
285 | { | 192 | |
286 | if ( HostP->Mapping[OldUnit-1].Topology[OldLink].Unit == ThisUnit && | 193 | /* |
287 | HostP->Mapping[OldUnit-1].Topology[OldLink].Link == ThisLink ) | 194 | ** this is what it is now connected to |
288 | { | 195 | */ |
289 | rio_dprintk (RIO_DEBUG_ROUTE, "SETTING RTA %s (%c) TO DISCONNECTED!\n", | 196 | NewUnit = RBYTE(PktCmdP->RouteTopology[ThisLink].Unit); |
290 | HostP->Mapping[OldUnit-1].Name,OldLink+'A'); | 197 | NewLink = RBYTE(PktCmdP->RouteTopology[ThisLink].Link); |
291 | HostP->Mapping[OldUnit-1].Topology[OldLink].Unit=ROUTE_DISCONNECT; | 198 | |
292 | HostP->Mapping[OldUnit-1].Topology[OldLink].Link=NO_LINK; | 199 | if (OldUnit != NewUnit || OldLink != NewLink) { |
293 | } | 200 | /* |
294 | else | 201 | ** something has changed! |
295 | { | 202 | */ |
296 | rio_dprintk (RIO_DEBUG_ROUTE, "RTA %s (%c) WAS NOT CONNECTED TO %s (%c)\n", | 203 | |
297 | HostP->Mapping[OldUnit-1].Name,OldLink+'A', | 204 | if (NewUnit > MAX_RUP && NewUnit != ROUTE_DISCONNECT && NewUnit != ROUTE_NO_ID && NewUnit != ROUTE_INTERCONNECT) { |
298 | HostP->Mapping[ThisUnit-1].Name,ThisLink+'A'); | 205 | 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); |
299 | } | 206 | } else { |
300 | } | 207 | /* |
301 | if ( NewUnit == HOST_ID ) | 208 | ** put the new values in |
302 | { | 209 | */ |
303 | rio_dprintk (RIO_DEBUG_ROUTE, "MARKING HOST (%c) CONNECTED TO %s (%c)\n", | 210 | TopP[ThisLink].Unit = NewUnit; |
304 | NewLink+'A',MyName,ThisLink+'A'); | 211 | TopP[ThisLink].Link = NewLink; |
305 | HostP->Topology[NewLink].Unit = ThisUnit; | 212 | |
306 | HostP->Topology[NewLink].Link = ThisLink; | 213 | RIOSetChange(p); |
307 | } | 214 | |
308 | else if ( NewUnit <= MAX_RUP ) | 215 | if (OldUnit <= MAX_RUP) { |
309 | { | 216 | /* |
310 | rio_dprintk (RIO_DEBUG_ROUTE, "MARKING RTA %s (%c) CONNECTED TO %s (%c)\n", | 217 | ** If something has become bust, then re-enable them messages |
311 | HostP->Mapping[NewUnit-1].Name,NewLink+'A',MyName,ThisLink+'A'); | 218 | */ |
312 | HostP->Mapping[NewUnit-1].Topology[NewLink].Unit=ThisUnit; | 219 | if (!p->RIONoMessage) |
313 | HostP->Mapping[NewUnit-1].Topology[NewLink].Link=ThisLink; | 220 | RIOConCon(p, HostP, ThisUnit, ThisLink, OldUnit, OldLink, DISCONNECT); |
314 | } | 221 | } |
222 | |||
223 | if ((NewUnit <= MAX_RUP) && !p->RIONoMessage) | ||
224 | RIOConCon(p, HostP, ThisUnit, ThisLink, NewUnit, NewLink, CONNECT); | ||
225 | |||
226 | if (NewUnit == ROUTE_NO_ID) | ||
227 | rio_dprintk(RIO_DEBUG_ROUTE, "%s %s (%c) is connected to an unconfigured unit.\n", MyType, MyName, 'A' + ThisLink); | ||
228 | |||
229 | if (NewUnit == ROUTE_INTERCONNECT) { | ||
230 | if (!p->RIONoMessage) | ||
231 | cprintf("%s '%s' (%c) is connected to another network.\n", MyType, MyName, 'A' + ThisLink); | ||
232 | } | ||
233 | |||
234 | /* | ||
235 | ** perform an update for 'the other end', so that these messages | ||
236 | ** only appears once. Only disconnect the other end if it is pointing | ||
237 | ** at us! | ||
238 | */ | ||
239 | if (OldUnit == HOST_ID) { | ||
240 | if (HostP->Topology[OldLink].Unit == ThisUnit && HostP->Topology[OldLink].Link == ThisLink) { | ||
241 | rio_dprintk(RIO_DEBUG_ROUTE, "SETTING HOST (%c) TO DISCONNECTED!\n", OldLink + 'A'); | ||
242 | HostP->Topology[OldLink].Unit = ROUTE_DISCONNECT; | ||
243 | HostP->Topology[OldLink].Link = NO_LINK; | ||
244 | } else { | ||
245 | rio_dprintk(RIO_DEBUG_ROUTE, "HOST(%c) WAS NOT CONNECTED TO %s (%c)!\n", OldLink + 'A', HostP->Mapping[ThisUnit - 1].Name, ThisLink + 'A'); | ||
246 | } | ||
247 | } else if (OldUnit <= MAX_RUP) { | ||
248 | if (HostP->Mapping[OldUnit - 1].Topology[OldLink].Unit == ThisUnit && HostP->Mapping[OldUnit - 1].Topology[OldLink].Link == ThisLink) { | ||
249 | rio_dprintk(RIO_DEBUG_ROUTE, "SETTING RTA %s (%c) TO DISCONNECTED!\n", HostP->Mapping[OldUnit - 1].Name, OldLink + 'A'); | ||
250 | HostP->Mapping[OldUnit - 1].Topology[OldLink].Unit = ROUTE_DISCONNECT; | ||
251 | HostP->Mapping[OldUnit - 1].Topology[OldLink].Link = NO_LINK; | ||
252 | } else { | ||
253 | 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'); | ||
254 | } | ||
255 | } | ||
256 | if (NewUnit == HOST_ID) { | ||
257 | rio_dprintk(RIO_DEBUG_ROUTE, "MARKING HOST (%c) CONNECTED TO %s (%c)\n", NewLink + 'A', MyName, ThisLink + 'A'); | ||
258 | HostP->Topology[NewLink].Unit = ThisUnit; | ||
259 | HostP->Topology[NewLink].Link = ThisLink; | ||
260 | } else if (NewUnit <= MAX_RUP) { | ||
261 | rio_dprintk(RIO_DEBUG_ROUTE, "MARKING RTA %s (%c) CONNECTED TO %s (%c)\n", HostP->Mapping[NewUnit - 1].Name, NewLink + 'A', MyName, ThisLink + 'A'); | ||
262 | HostP->Mapping[NewUnit - 1].Topology[NewLink].Unit = ThisUnit; | ||
263 | HostP->Mapping[NewUnit - 1].Topology[NewLink].Link = ThisLink; | ||
264 | } | ||
265 | } | ||
266 | RIOSetChange(p); | ||
267 | RIOCheckIsolated(p, HostP, OldUnit); | ||
268 | } | ||
269 | } | ||
270 | return TRUE; | ||
315 | } | 271 | } |
316 | RIOSetChange(p); | 272 | |
317 | RIOCheckIsolated(p, HostP, OldUnit ); | 273 | /* |
318 | } | 274 | ** The only other command we recognise is a route_request command |
319 | } | 275 | */ |
320 | return TRUE; | 276 | if (RBYTE(PktCmdP->Command) != ROUTE_REQUEST) { |
321 | } | 277 | rio_dprintk(RIO_DEBUG_ROUTE, "Unknown command %d received on rup %d host %d ROUTE_RUP\n", RBYTE(PktCmdP->Command), Rup, (int) HostP); |
322 | 278 | return TRUE; | |
323 | /* | ||
324 | ** The only other command we recognise is a route_request command | ||
325 | */ | ||
326 | if ( RBYTE(PktCmdP->Command) != ROUTE_REQUEST ) | ||
327 | { | ||
328 | rio_dprintk (RIO_DEBUG_ROUTE, "Unknown command %d received on rup %d host %d ROUTE_RUP\n", | ||
329 | RBYTE(PktCmdP->Command),Rup,(int)HostP); | ||
330 | return TRUE; | ||
331 | } | ||
332 | |||
333 | RtaUniq = (RBYTE(PktCmdP->UniqNum[0])) + | ||
334 | (RBYTE(PktCmdP->UniqNum[1]) << 8) + | ||
335 | (RBYTE(PktCmdP->UniqNum[2]) << 16) + | ||
336 | (RBYTE(PktCmdP->UniqNum[3]) << 24); | ||
337 | |||
338 | /* | ||
339 | ** Determine if 8 or 16 port RTA | ||
340 | */ | ||
341 | RtaType = GetUnitType(RtaUniq); | ||
342 | |||
343 | rio_dprintk (RIO_DEBUG_ROUTE, "Received a request for an ID for serial number %x\n", RtaUniq); | ||
344 | |||
345 | Mod = RBYTE(PktCmdP->ModuleTypes); | ||
346 | Mod1 = LONYBLE(Mod); | ||
347 | if (RtaType == TYPE_RTA16) | ||
348 | { | ||
349 | /* | ||
350 | ** Only one ident is set for a 16 port RTA. To make compatible | ||
351 | ** with 8 port, set 2nd ident in Mod2 to the same as Mod1. | ||
352 | */ | ||
353 | Mod2 = Mod1; | ||
354 | rio_dprintk (RIO_DEBUG_ROUTE, "Backplane type is %s (all ports)\n", | ||
355 | p->RIOModuleTypes[Mod1].Name); | ||
356 | } | ||
357 | else | ||
358 | { | ||
359 | Mod2 = HINYBLE(Mod); | ||
360 | rio_dprintk (RIO_DEBUG_ROUTE, "Module types are %s (ports 0-3) and %s (ports 4-7)\n", | ||
361 | p->RIOModuleTypes[Mod1].Name, p->RIOModuleTypes[Mod2].Name); | ||
362 | } | ||
363 | |||
364 | if ( RtaUniq == 0xffffffff ) | ||
365 | { | ||
366 | ShowPacket( DBG_SPECIAL, PacketP ); | ||
367 | } | ||
368 | |||
369 | /* | ||
370 | ** try to unhook a command block from the command free list. | ||
371 | */ | ||
372 | if ( !(CmdBlkP = RIOGetCmdBlk()) ) | ||
373 | { | ||
374 | rio_dprintk (RIO_DEBUG_ROUTE, "No command blocks to route RTA! come back later.\n"); | ||
375 | return 0; | ||
376 | } | ||
377 | |||
378 | /* | ||
379 | ** Fill in the default info on the command block | ||
380 | */ | ||
381 | CmdBlkP->Packet.dest_unit = Rup; | ||
382 | CmdBlkP->Packet.dest_port = ROUTE_RUP; | ||
383 | CmdBlkP->Packet.src_unit = HOST_ID; | ||
384 | CmdBlkP->Packet.src_port = ROUTE_RUP; | ||
385 | CmdBlkP->Packet.len = PKT_CMD_BIT | 1; | ||
386 | CmdBlkP->PreFuncP = CmdBlkP->PostFuncP = NULL; | ||
387 | PktReplyP = (struct PktCmd_M *)CmdBlkP->Packet.data; | ||
388 | |||
389 | if (! RIOBootOk(p, HostP, RtaUniq)) | ||
390 | { | ||
391 | rio_dprintk (RIO_DEBUG_ROUTE, "RTA %x tried to get an ID, but does not belong - FOAD it!\n", | ||
392 | RtaUniq); | ||
393 | PktReplyP->Command = ROUTE_FOAD; | ||
394 | HostP->Copy("RT_FOAD", PktReplyP->CommandText, 7); | ||
395 | RIOQueueCmdBlk(HostP, Rup, CmdBlkP); | ||
396 | return TRUE; | ||
397 | } | ||
398 | |||
399 | /* | ||
400 | ** Check to see if the RTA is configured for this host | ||
401 | */ | ||
402 | for ( ThisUnit=0; ThisUnit<MAX_RUP; ThisUnit++ ) | ||
403 | { | ||
404 | rio_dprintk (RIO_DEBUG_ROUTE, "Entry %d Flags=%s %s UniqueNum=0x%x\n", | ||
405 | ThisUnit, | ||
406 | HostP->Mapping[ThisUnit].Flags & SLOT_IN_USE ? | ||
407 | "Slot-In-Use":"Not In Use", | ||
408 | HostP->Mapping[ThisUnit].Flags & SLOT_TENTATIVE ? | ||
409 | "Slot-Tentative":"Not Tentative", | ||
410 | HostP->Mapping[ThisUnit].RtaUniqueNum); | ||
411 | |||
412 | /* | ||
413 | ** We have an entry for it. | ||
414 | */ | ||
415 | if ( (HostP->Mapping[ThisUnit].Flags & (SLOT_IN_USE | SLOT_TENTATIVE)) && | ||
416 | (HostP->Mapping[ThisUnit].RtaUniqueNum == RtaUniq) ) | ||
417 | { | ||
418 | if (RtaType == TYPE_RTA16) | ||
419 | { | ||
420 | ThisUnit2 = HostP->Mapping[ThisUnit].ID2 - 1; | ||
421 | rio_dprintk (RIO_DEBUG_ROUTE, "Found unit 0x%x at slots %d+%d\n", | ||
422 | RtaUniq,ThisUnit,ThisUnit2); | ||
423 | } | ||
424 | else | ||
425 | rio_dprintk (RIO_DEBUG_ROUTE, "Found unit 0x%x at slot %d\n", | ||
426 | RtaUniq,ThisUnit); | ||
427 | /* | ||
428 | ** If we have no knowledge of booting it, then the host has | ||
429 | ** been re-booted, and so we must kill the RTA, so that it | ||
430 | ** will be booted again (potentially with new bins) | ||
431 | ** and it will then re-ask for an ID, which we will service. | ||
432 | */ | ||
433 | if ( (HostP->Mapping[ThisUnit].Flags & SLOT_IN_USE) && | ||
434 | !(HostP->Mapping[ThisUnit].Flags & RTA_BOOTED) ) | ||
435 | { | ||
436 | if ( !(HostP->Mapping[ThisUnit].Flags & MSG_DONE) ) | ||
437 | { | ||
438 | if ( !p->RIONoMessage ) | ||
439 | cprintf("RTA '%s' is being updated.\n",HostP->Mapping[ThisUnit].Name); | ||
440 | HostP->Mapping[ThisUnit].Flags |= MSG_DONE; | ||
441 | } | 279 | } |
442 | PktReplyP->Command = ROUTE_FOAD; | 280 | |
443 | HostP->Copy("RT_FOAD",PktReplyP->CommandText,7); | 281 | RtaUniq = (RBYTE(PktCmdP->UniqNum[0])) + (RBYTE(PktCmdP->UniqNum[1]) << 8) + (RBYTE(PktCmdP->UniqNum[2]) << 16) + (RBYTE(PktCmdP->UniqNum[3]) << 24); |
444 | RIOQueueCmdBlk(HostP, Rup, CmdBlkP); | 282 | |
445 | return TRUE; | ||
446 | } | ||
447 | |||
448 | /* | ||
449 | ** Send the ID (entry) to this RTA. The ID number is implicit as | ||
450 | ** the offset into the table. It is worth noting at this stage | ||
451 | ** that offset zero in the table contains the entries for the | ||
452 | ** RTA with ID 1!!!! | ||
453 | */ | ||
454 | PktReplyP->Command = ROUTE_ALLOCATE; | ||
455 | PktReplyP->IDNum = ThisUnit+1; | ||
456 | if (RtaType == TYPE_RTA16) | ||
457 | { | ||
458 | if (HostP->Mapping[ThisUnit].Flags & SLOT_IN_USE) | ||
459 | /* | ||
460 | ** Adjust the phb and tx pkt dest_units for 2nd block of 8 | ||
461 | ** only if the RTA has ports associated (SLOT_IN_USE) | ||
462 | */ | ||
463 | RIOFixPhbs(p, HostP, ThisUnit2); | ||
464 | PktReplyP->IDNum2 = ThisUnit2+1; | ||
465 | rio_dprintk (RIO_DEBUG_ROUTE, "RTA '%s' has been allocated IDs %d+%d\n", | ||
466 | HostP->Mapping[ThisUnit].Name, PktReplyP->IDNum, PktReplyP->IDNum2); | ||
467 | } | ||
468 | else | ||
469 | { | ||
470 | PktReplyP->IDNum2 = ROUTE_NO_ID; | ||
471 | rio_dprintk (RIO_DEBUG_ROUTE, "RTA '%s' has been allocated ID %d\n", | ||
472 | HostP->Mapping[ThisUnit].Name,PktReplyP->IDNum); | ||
473 | } | ||
474 | HostP->Copy("RT_ALLOCAT",PktReplyP->CommandText,10); | ||
475 | |||
476 | RIOQueueCmdBlk( HostP, Rup, CmdBlkP); | ||
477 | |||
478 | /* | ||
479 | ** If this is a freshly booted RTA, then we need to re-open | ||
480 | ** the ports, if any where open, so that data may once more | ||
481 | ** flow around the system! | ||
482 | */ | ||
483 | if ( (HostP->Mapping[ThisUnit].Flags & RTA_NEWBOOT) && | ||
484 | (HostP->Mapping[ThisUnit].SysPort != NO_PORT) ) | ||
485 | { | ||
486 | /* | 283 | /* |
487 | ** look at the ports associated with this beast and | 284 | ** Determine if 8 or 16 port RTA |
488 | ** see if any where open. If they was, then re-open | 285 | */ |
489 | ** them, using the info from the tty flags. | 286 | RtaType = GetUnitType(RtaUniq); |
490 | */ | 287 | |
491 | for ( port=0; port<PORTS_PER_RTA; port++ ) | 288 | rio_dprintk(RIO_DEBUG_ROUTE, "Received a request for an ID for serial number %x\n", RtaUniq); |
492 | { | 289 | |
493 | PortP = p->RIOPortp[port+HostP->Mapping[ThisUnit].SysPort]; | 290 | Mod = RBYTE(PktCmdP->ModuleTypes); |
494 | if ( PortP->State & (RIO_MOPEN|RIO_LOPEN) ) | 291 | Mod1 = LONYBLE(Mod); |
495 | { | 292 | if (RtaType == TYPE_RTA16) { |
496 | rio_dprintk (RIO_DEBUG_ROUTE, "Re-opened this port\n"); | 293 | /* |
497 | rio_spin_lock_irqsave(&PortP->portSem, flags); | 294 | ** Only one ident is set for a 16 port RTA. To make compatible |
498 | PortP->MagicFlags |= MAGIC_REBOOT; | 295 | ** with 8 port, set 2nd ident in Mod2 to the same as Mod1. |
499 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | 296 | */ |
500 | } | 297 | Mod2 = Mod1; |
298 | rio_dprintk(RIO_DEBUG_ROUTE, "Backplane type is %s (all ports)\n", p->RIOModuleTypes[Mod1].Name); | ||
299 | } else { | ||
300 | Mod2 = HINYBLE(Mod); | ||
301 | 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); | ||
501 | } | 302 | } |
502 | if (RtaType == TYPE_RTA16) | 303 | |
503 | { | 304 | if (RtaUniq == 0xffffffff) { |
504 | for ( port=0; port<PORTS_PER_RTA; port++ ) | 305 | ShowPacket(DBG_SPECIAL, PacketP); |
505 | { | ||
506 | PortP = p->RIOPortp[port+HostP->Mapping[ThisUnit2].SysPort]; | ||
507 | if ( PortP->State & (RIO_MOPEN|RIO_LOPEN) ) | ||
508 | { | ||
509 | rio_dprintk (RIO_DEBUG_ROUTE, "Re-opened this port\n"); | ||
510 | rio_spin_lock_irqsave(&PortP->portSem, flags); | ||
511 | PortP->MagicFlags |= MAGIC_REBOOT; | ||
512 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | ||
513 | } | ||
514 | } | ||
515 | } | 306 | } |
516 | } | 307 | |
517 | 308 | /* | |
518 | /* | 309 | ** try to unhook a command block from the command free list. |
519 | ** keep a copy of the module types! | 310 | */ |
520 | */ | 311 | if (!(CmdBlkP = RIOGetCmdBlk())) { |
521 | HostP->UnixRups[ThisUnit].ModTypes = Mod; | 312 | rio_dprintk(RIO_DEBUG_ROUTE, "No command blocks to route RTA! come back later.\n"); |
522 | if (RtaType == TYPE_RTA16) | 313 | return 0; |
523 | HostP->UnixRups[ThisUnit2].ModTypes = Mod; | ||
524 | |||
525 | /* | ||
526 | ** If either of the modules on this unit is read-only or write-only | ||
527 | ** or none-xprint, then we need to transfer that info over to the | ||
528 | ** relevant ports. | ||
529 | */ | ||
530 | if ( HostP->Mapping[ThisUnit].SysPort != NO_PORT ) | ||
531 | { | ||
532 | for ( port=0; port<PORTS_PER_MODULE; port++ ) | ||
533 | { | ||
534 | p->RIOPortp[port+HostP->Mapping[ThisUnit].SysPort]->Config &= ~RIO_NOMASK; | ||
535 | p->RIOPortp[port+HostP->Mapping[ThisUnit].SysPort]->Config |= | ||
536 | p->RIOModuleTypes[Mod1].Flags[port]; | ||
537 | p->RIOPortp[port+PORTS_PER_MODULE+HostP->Mapping[ThisUnit].SysPort]->Config &= ~RIO_NOMASK; | ||
538 | p->RIOPortp[port+PORTS_PER_MODULE+HostP->Mapping[ThisUnit].SysPort]->Config |= p->RIOModuleTypes[Mod2].Flags[port]; | ||
539 | } | 314 | } |
540 | if (RtaType == TYPE_RTA16) | 315 | |
541 | { | 316 | /* |
542 | for ( port=0; port<PORTS_PER_MODULE; port++ ) | 317 | ** Fill in the default info on the command block |
543 | { | 318 | */ |
544 | p->RIOPortp[port+HostP->Mapping[ThisUnit2].SysPort]->Config &= ~RIO_NOMASK; | 319 | CmdBlkP->Packet.dest_unit = Rup; |
545 | p->RIOPortp[port+HostP->Mapping[ThisUnit2].SysPort]->Config |= p->RIOModuleTypes[Mod1].Flags[port]; | 320 | CmdBlkP->Packet.dest_port = ROUTE_RUP; |
546 | p->RIOPortp[port+PORTS_PER_MODULE+HostP->Mapping[ThisUnit2].SysPort]->Config &= ~RIO_NOMASK; | 321 | CmdBlkP->Packet.src_unit = HOST_ID; |
547 | p->RIOPortp[port+PORTS_PER_MODULE+HostP->Mapping[ThisUnit2].SysPort]->Config |= p->RIOModuleTypes[Mod2].Flags[port]; | 322 | CmdBlkP->Packet.src_port = ROUTE_RUP; |
548 | } | 323 | CmdBlkP->Packet.len = PKT_CMD_BIT | 1; |
324 | CmdBlkP->PreFuncP = CmdBlkP->PostFuncP = NULL; | ||
325 | PktReplyP = (struct PktCmd_M *) CmdBlkP->Packet.data; | ||
326 | |||
327 | if (!RIOBootOk(p, HostP, RtaUniq)) { | ||
328 | rio_dprintk(RIO_DEBUG_ROUTE, "RTA %x tried to get an ID, but does not belong - FOAD it!\n", RtaUniq); | ||
329 | PktReplyP->Command = ROUTE_FOAD; | ||
330 | HostP->Copy("RT_FOAD", PktReplyP->CommandText, 7); | ||
331 | RIOQueueCmdBlk(HostP, Rup, CmdBlkP); | ||
332 | return TRUE; | ||
549 | } | 333 | } |
550 | } | 334 | |
551 | 335 | /* | |
552 | /* | 336 | ** Check to see if the RTA is configured for this host |
553 | ** Job done, get on with the interrupts! | 337 | */ |
554 | */ | 338 | for (ThisUnit = 0; ThisUnit < MAX_RUP; ThisUnit++) { |
555 | return TRUE; | 339 | rio_dprintk(RIO_DEBUG_ROUTE, "Entry %d Flags=%s %s UniqueNum=0x%x\n", |
556 | } | 340 | 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); |
557 | } | 341 | |
558 | /* | 342 | /* |
559 | ** There is no table entry for this RTA at all. | 343 | ** We have an entry for it. |
560 | ** | 344 | */ |
561 | ** Lets check to see if we actually booted this unit - if not, | 345 | if ((HostP->Mapping[ThisUnit].Flags & (SLOT_IN_USE | SLOT_TENTATIVE)) && (HostP->Mapping[ThisUnit].RtaUniqueNum == RtaUniq)) { |
562 | ** then we reset it and it will go round the loop of being booted | 346 | if (RtaType == TYPE_RTA16) { |
563 | ** we can then worry about trying to fit it into the table. | 347 | ThisUnit2 = HostP->Mapping[ThisUnit].ID2 - 1; |
564 | */ | 348 | rio_dprintk(RIO_DEBUG_ROUTE, "Found unit 0x%x at slots %d+%d\n", RtaUniq, ThisUnit, ThisUnit2); |
565 | for ( ThisUnit=0; ThisUnit<HostP->NumExtraBooted; ThisUnit++ ) | 349 | } else |
566 | if ( HostP->ExtraUnits[ThisUnit] == RtaUniq ) | 350 | rio_dprintk(RIO_DEBUG_ROUTE, "Found unit 0x%x at slot %d\n", RtaUniq, ThisUnit); |
567 | break; | 351 | /* |
568 | if ( ThisUnit == HostP->NumExtraBooted && ThisUnit != MAX_EXTRA_UNITS ) | 352 | ** If we have no knowledge of booting it, then the host has |
569 | { | 353 | ** been re-booted, and so we must kill the RTA, so that it |
570 | /* | 354 | ** will be booted again (potentially with new bins) |
571 | ** if the unit wasn't in the table, and the table wasn't full, then | 355 | ** and it will then re-ask for an ID, which we will service. |
572 | ** we reset the unit, because we didn't boot it. | 356 | */ |
573 | ** However, if the table is full, it could be that we did boot | 357 | if ((HostP->Mapping[ThisUnit].Flags & SLOT_IN_USE) && !(HostP->Mapping[ThisUnit].Flags & RTA_BOOTED)) { |
574 | ** this unit, and so we won't reboot it, because it isn't really | 358 | if (!(HostP->Mapping[ThisUnit].Flags & MSG_DONE)) { |
575 | ** all that disasterous to keep the old bins in most cases. This | 359 | if (!p->RIONoMessage) |
576 | ** is a rather tacky feature, but we are on the edge of reallity | 360 | cprintf("RTA '%s' is being updated.\n", HostP->Mapping[ThisUnit].Name); |
577 | ** here, because the implication is that someone has connected | 361 | HostP->Mapping[ThisUnit].Flags |= MSG_DONE; |
578 | ** 16+MAX_EXTRA_UNITS onto one host. | 362 | } |
579 | */ | 363 | PktReplyP->Command = ROUTE_FOAD; |
580 | static int UnknownMesgDone = 0; | 364 | HostP->Copy("RT_FOAD", PktReplyP->CommandText, 7); |
581 | 365 | RIOQueueCmdBlk(HostP, Rup, CmdBlkP); | |
582 | if ( !UnknownMesgDone ) | 366 | return TRUE; |
583 | { | 367 | } |
584 | if (! p->RIONoMessage) | 368 | |
585 | cprintf("One or more unknown RTAs are being updated.\n"); | 369 | /* |
586 | UnknownMesgDone = 1; | 370 | ** Send the ID (entry) to this RTA. The ID number is implicit as |
587 | } | 371 | ** the offset into the table. It is worth noting at this stage |
588 | 372 | ** that offset zero in the table contains the entries for the | |
589 | PktReplyP->Command = ROUTE_FOAD; | 373 | ** RTA with ID 1!!!! |
590 | HostP->Copy("RT_FOAD",PktReplyP->CommandText,7); | 374 | */ |
591 | } | 375 | PktReplyP->Command = ROUTE_ALLOCATE; |
592 | else | 376 | PktReplyP->IDNum = ThisUnit + 1; |
593 | { | 377 | if (RtaType == TYPE_RTA16) { |
594 | /* | 378 | if (HostP->Mapping[ThisUnit].Flags & SLOT_IN_USE) |
595 | ** we did boot it (as an extra), and there may now be a table | 379 | /* |
596 | ** slot free (because of a delete), so we will try to make | 380 | ** Adjust the phb and tx pkt dest_units for 2nd block of 8 |
597 | ** a tentative entry for it, so that the configurator can see it | 381 | ** only if the RTA has ports associated (SLOT_IN_USE) |
598 | ** and fill in the details for us. | 382 | */ |
599 | */ | 383 | RIOFixPhbs(p, HostP, ThisUnit2); |
600 | if (RtaType == TYPE_RTA16) | 384 | PktReplyP->IDNum2 = ThisUnit2 + 1; |
601 | { | 385 | rio_dprintk(RIO_DEBUG_ROUTE, "RTA '%s' has been allocated IDs %d+%d\n", HostP->Mapping[ThisUnit].Name, PktReplyP->IDNum, PktReplyP->IDNum2); |
602 | if (RIOFindFreeID(p, HostP, &ThisUnit, &ThisUnit2) == 0) | 386 | } else { |
603 | { | 387 | PktReplyP->IDNum2 = ROUTE_NO_ID; |
604 | RIODefaultName(p, HostP, ThisUnit); | 388 | rio_dprintk(RIO_DEBUG_ROUTE, "RTA '%s' has been allocated ID %d\n", HostP->Mapping[ThisUnit].Name, PktReplyP->IDNum); |
605 | FillSlot(ThisUnit, ThisUnit2, RtaUniq, HostP); | 389 | } |
390 | HostP->Copy("RT_ALLOCAT", PktReplyP->CommandText, 10); | ||
391 | |||
392 | RIOQueueCmdBlk(HostP, Rup, CmdBlkP); | ||
393 | |||
394 | /* | ||
395 | ** If this is a freshly booted RTA, then we need to re-open | ||
396 | ** the ports, if any where open, so that data may once more | ||
397 | ** flow around the system! | ||
398 | */ | ||
399 | if ((HostP->Mapping[ThisUnit].Flags & RTA_NEWBOOT) && (HostP->Mapping[ThisUnit].SysPort != NO_PORT)) { | ||
400 | /* | ||
401 | ** look at the ports associated with this beast and | ||
402 | ** see if any where open. If they was, then re-open | ||
403 | ** them, using the info from the tty flags. | ||
404 | */ | ||
405 | for (port = 0; port < PORTS_PER_RTA; port++) { | ||
406 | PortP = p->RIOPortp[port + HostP->Mapping[ThisUnit].SysPort]; | ||
407 | if (PortP->State & (RIO_MOPEN | RIO_LOPEN)) { | ||
408 | rio_dprintk(RIO_DEBUG_ROUTE, "Re-opened this port\n"); | ||
409 | rio_spin_lock_irqsave(&PortP->portSem, flags); | ||
410 | PortP->MagicFlags |= MAGIC_REBOOT; | ||
411 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | ||
412 | } | ||
413 | } | ||
414 | if (RtaType == TYPE_RTA16) { | ||
415 | for (port = 0; port < PORTS_PER_RTA; port++) { | ||
416 | PortP = p->RIOPortp[port + HostP->Mapping[ThisUnit2].SysPort]; | ||
417 | if (PortP->State & (RIO_MOPEN | RIO_LOPEN)) { | ||
418 | rio_dprintk(RIO_DEBUG_ROUTE, "Re-opened this port\n"); | ||
419 | rio_spin_lock_irqsave(&PortP->portSem, flags); | ||
420 | PortP->MagicFlags |= MAGIC_REBOOT; | ||
421 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | ||
422 | } | ||
423 | } | ||
424 | } | ||
425 | } | ||
426 | |||
427 | /* | ||
428 | ** keep a copy of the module types! | ||
429 | */ | ||
430 | HostP->UnixRups[ThisUnit].ModTypes = Mod; | ||
431 | if (RtaType == TYPE_RTA16) | ||
432 | HostP->UnixRups[ThisUnit2].ModTypes = Mod; | ||
433 | |||
434 | /* | ||
435 | ** If either of the modules on this unit is read-only or write-only | ||
436 | ** or none-xprint, then we need to transfer that info over to the | ||
437 | ** relevant ports. | ||
438 | */ | ||
439 | if (HostP->Mapping[ThisUnit].SysPort != NO_PORT) { | ||
440 | for (port = 0; port < PORTS_PER_MODULE; port++) { | ||
441 | p->RIOPortp[port + HostP->Mapping[ThisUnit].SysPort]->Config &= ~RIO_NOMASK; | ||
442 | p->RIOPortp[port + HostP->Mapping[ThisUnit].SysPort]->Config |= p->RIOModuleTypes[Mod1].Flags[port]; | ||
443 | p->RIOPortp[port + PORTS_PER_MODULE + HostP->Mapping[ThisUnit].SysPort]->Config &= ~RIO_NOMASK; | ||
444 | p->RIOPortp[port + PORTS_PER_MODULE + HostP->Mapping[ThisUnit].SysPort]->Config |= p->RIOModuleTypes[Mod2].Flags[port]; | ||
445 | } | ||
446 | if (RtaType == TYPE_RTA16) { | ||
447 | for (port = 0; port < PORTS_PER_MODULE; port++) { | ||
448 | p->RIOPortp[port + HostP->Mapping[ThisUnit2].SysPort]->Config &= ~RIO_NOMASK; | ||
449 | p->RIOPortp[port + HostP->Mapping[ThisUnit2].SysPort]->Config |= p->RIOModuleTypes[Mod1].Flags[port]; | ||
450 | p->RIOPortp[port + PORTS_PER_MODULE + HostP->Mapping[ThisUnit2].SysPort]->Config &= ~RIO_NOMASK; | ||
451 | p->RIOPortp[port + PORTS_PER_MODULE + HostP->Mapping[ThisUnit2].SysPort]->Config |= p->RIOModuleTypes[Mod2].Flags[port]; | ||
452 | } | ||
453 | } | ||
454 | } | ||
455 | |||
456 | /* | ||
457 | ** Job done, get on with the interrupts! | ||
458 | */ | ||
459 | return TRUE; | ||
460 | } | ||
606 | } | 461 | } |
607 | } | 462 | /* |
608 | else | 463 | ** There is no table entry for this RTA at all. |
609 | { | 464 | ** |
610 | if (RIOFindFreeID(p, HostP, &ThisUnit, NULL) == 0) | 465 | ** Lets check to see if we actually booted this unit - if not, |
611 | { | 466 | ** then we reset it and it will go round the loop of being booted |
612 | RIODefaultName(p, HostP, ThisUnit); | 467 | ** we can then worry about trying to fit it into the table. |
613 | FillSlot(ThisUnit, 0, RtaUniq, HostP); | 468 | */ |
469 | for (ThisUnit = 0; ThisUnit < HostP->NumExtraBooted; ThisUnit++) | ||
470 | if (HostP->ExtraUnits[ThisUnit] == RtaUniq) | ||
471 | break; | ||
472 | if (ThisUnit == HostP->NumExtraBooted && ThisUnit != MAX_EXTRA_UNITS) { | ||
473 | /* | ||
474 | ** if the unit wasn't in the table, and the table wasn't full, then | ||
475 | ** we reset the unit, because we didn't boot it. | ||
476 | ** However, if the table is full, it could be that we did boot | ||
477 | ** this unit, and so we won't reboot it, because it isn't really | ||
478 | ** all that disasterous to keep the old bins in most cases. This | ||
479 | ** is a rather tacky feature, but we are on the edge of reallity | ||
480 | ** here, because the implication is that someone has connected | ||
481 | ** 16+MAX_EXTRA_UNITS onto one host. | ||
482 | */ | ||
483 | static int UnknownMesgDone = 0; | ||
484 | |||
485 | if (!UnknownMesgDone) { | ||
486 | if (!p->RIONoMessage) | ||
487 | cprintf("One or more unknown RTAs are being updated.\n"); | ||
488 | UnknownMesgDone = 1; | ||
489 | } | ||
490 | |||
491 | PktReplyP->Command = ROUTE_FOAD; | ||
492 | HostP->Copy("RT_FOAD", PktReplyP->CommandText, 7); | ||
493 | } else { | ||
494 | /* | ||
495 | ** we did boot it (as an extra), and there may now be a table | ||
496 | ** slot free (because of a delete), so we will try to make | ||
497 | ** a tentative entry for it, so that the configurator can see it | ||
498 | ** and fill in the details for us. | ||
499 | */ | ||
500 | if (RtaType == TYPE_RTA16) { | ||
501 | if (RIOFindFreeID(p, HostP, &ThisUnit, &ThisUnit2) == 0) { | ||
502 | RIODefaultName(p, HostP, ThisUnit); | ||
503 | FillSlot(ThisUnit, ThisUnit2, RtaUniq, HostP); | ||
504 | } | ||
505 | } else { | ||
506 | if (RIOFindFreeID(p, HostP, &ThisUnit, NULL) == 0) { | ||
507 | RIODefaultName(p, HostP, ThisUnit); | ||
508 | FillSlot(ThisUnit, 0, RtaUniq, HostP); | ||
509 | } | ||
510 | } | ||
511 | PktReplyP->Command = ROUTE_USED; | ||
512 | HostP->Copy("RT_USED", PktReplyP->CommandText, 7); | ||
614 | } | 513 | } |
615 | } | 514 | RIOQueueCmdBlk(HostP, Rup, CmdBlkP); |
616 | PktReplyP->Command = ROUTE_USED; | 515 | return TRUE; |
617 | HostP->Copy("RT_USED",PktReplyP->CommandText,7); | ||
618 | } | ||
619 | RIOQueueCmdBlk( HostP, Rup, CmdBlkP); | ||
620 | return TRUE; | ||
621 | } | 516 | } |
622 | 517 | ||
623 | 518 | ||
624 | void | 519 | void RIOFixPhbs(p, HostP, unit) |
625 | RIOFixPhbs(p, HostP, unit) | ||
626 | struct rio_info *p; | 520 | struct rio_info *p; |
627 | struct Host *HostP; | 521 | struct Host *HostP; |
628 | uint unit; | 522 | uint unit; |
629 | { | 523 | { |
630 | ushort link, port; | 524 | ushort link, port; |
631 | struct Port *PortP; | 525 | struct Port *PortP; |
632 | unsigned long flags; | 526 | unsigned long flags; |
633 | int PortN = HostP->Mapping[unit].SysPort; | 527 | int PortN = HostP->Mapping[unit].SysPort; |
634 | 528 | ||
635 | rio_dprintk (RIO_DEBUG_ROUTE, "RIOFixPhbs unit %d sysport %d\n", unit, PortN); | 529 | rio_dprintk(RIO_DEBUG_ROUTE, "RIOFixPhbs unit %d sysport %d\n", unit, PortN); |
636 | 530 | ||
637 | if (PortN != -1) { | 531 | if (PortN != -1) { |
638 | ushort dest_unit = HostP->Mapping[unit].ID2; | 532 | ushort dest_unit = HostP->Mapping[unit].ID2; |
639 | 533 | ||
640 | /* | 534 | /* |
641 | ** Get the link number used for the 1st 8 phbs on this unit. | 535 | ** Get the link number used for the 1st 8 phbs on this unit. |
642 | */ | 536 | */ |
643 | PortP = p->RIOPortp[HostP->Mapping[dest_unit - 1].SysPort]; | 537 | PortP = p->RIOPortp[HostP->Mapping[dest_unit - 1].SysPort]; |
644 | 538 | ||
645 | link = RWORD(PortP->PhbP->link); | 539 | link = RWORD(PortP->PhbP->link); |
646 | 540 | ||
647 | for (port = 0; port < PORTS_PER_RTA; port++, PortN++) { | 541 | for (port = 0; port < PORTS_PER_RTA; port++, PortN++) { |
648 | ushort dest_port = port + 8; | 542 | ushort dest_port = port + 8; |
649 | #if 0 | 543 | #if 0 |
650 | uint PktInt; | 544 | uint PktInt; |
651 | #endif | 545 | #endif |
652 | WORD *TxPktP; | 546 | WORD *TxPktP; |
653 | PKT *Pkt; | 547 | PKT *Pkt; |
654 | 548 | ||
655 | PortP = p->RIOPortp[PortN]; | 549 | PortP = p->RIOPortp[PortN]; |
656 | 550 | ||
657 | rio_spin_lock_irqsave(&PortP->portSem, flags); | 551 | rio_spin_lock_irqsave(&PortP->portSem, flags); |
658 | /* | 552 | /* |
659 | ** If RTA is not powered on, the tx packets will be | 553 | ** If RTA is not powered on, the tx packets will be |
660 | ** unset, so go no further. | 554 | ** unset, so go no further. |
661 | */ | 555 | */ |
662 | if (PortP->TxStart == 0) { | 556 | if (PortP->TxStart == 0) { |
663 | rio_dprintk (RIO_DEBUG_ROUTE, "Tx pkts not set up yet\n"); | 557 | rio_dprintk(RIO_DEBUG_ROUTE, "Tx pkts not set up yet\n"); |
664 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | 558 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); |
665 | break; | 559 | break; |
666 | } | 560 | } |
667 | 561 | ||
668 | /* | 562 | /* |
669 | ** For the second slot of a 16 port RTA, the driver needs to | 563 | ** For the second slot of a 16 port RTA, the driver needs to |
670 | ** sort out the phb to port mappings. The dest_unit for this | 564 | ** sort out the phb to port mappings. The dest_unit for this |
671 | ** group of 8 phbs is set to the dest_unit of the accompanying | 565 | ** group of 8 phbs is set to the dest_unit of the accompanying |
672 | ** 8 port block. The dest_port of the second unit is set to | 566 | ** 8 port block. The dest_port of the second unit is set to |
673 | ** be in the range 8-15 (i.e. 8 is added). Thus, for a 16 port | 567 | ** be in the range 8-15 (i.e. 8 is added). Thus, for a 16 port |
674 | ** RTA with IDs 5 and 6, traffic bound for port 6 of unit 6 | 568 | ** RTA with IDs 5 and 6, traffic bound for port 6 of unit 6 |
675 | ** (being the second map ID) will be sent to dest_unit 5, port | 569 | ** (being the second map ID) will be sent to dest_unit 5, port |
676 | ** 14. When this RTA is deleted, dest_unit for ID 6 will be | 570 | ** 14. When this RTA is deleted, dest_unit for ID 6 will be |
677 | ** restored, and the dest_port will be reduced by 8. | 571 | ** restored, and the dest_port will be reduced by 8. |
678 | ** Transmit packets also have a destination field which needs | 572 | ** Transmit packets also have a destination field which needs |
679 | ** adjusting in the same manner. | 573 | ** adjusting in the same manner. |
680 | ** Note that the unit/port bytes in 'dest' are swapped. | 574 | ** Note that the unit/port bytes in 'dest' are swapped. |
681 | ** We also need to adjust the phb and rup link numbers for the | 575 | ** We also need to adjust the phb and rup link numbers for the |
682 | ** second block of 8 ttys. | 576 | ** second block of 8 ttys. |
683 | */ | 577 | */ |
684 | for (TxPktP = PortP->TxStart; TxPktP <= PortP->TxEnd; TxPktP++) { | 578 | for (TxPktP = PortP->TxStart; TxPktP <= PortP->TxEnd; TxPktP++) { |
685 | /* | 579 | /* |
686 | ** *TxPktP is the pointer to the transmit packet on the host | 580 | ** *TxPktP is the pointer to the transmit packet on the host |
687 | ** card. This needs to be translated into a 32 bit pointer | 581 | ** card. This needs to be translated into a 32 bit pointer |
688 | ** so it can be accessed from the driver. | 582 | ** so it can be accessed from the driver. |
689 | */ | 583 | */ |
690 | Pkt = (PKT *) RIO_PTR(HostP->Caddr,RINDW(TxPktP)); | 584 | Pkt = (PKT *) RIO_PTR(HostP->Caddr, RINDW(TxPktP)); |
691 | 585 | ||
692 | /* | 586 | /* |
693 | ** If the packet is used, reset it. | 587 | ** If the packet is used, reset it. |
694 | */ | 588 | */ |
695 | Pkt = (PKT *)((uint)Pkt & ~PKT_IN_USE); | 589 | Pkt = (PKT *) ((uint) Pkt & ~PKT_IN_USE); |
696 | WBYTE(Pkt->dest_unit, dest_unit); | 590 | WBYTE(Pkt->dest_unit, dest_unit); |
697 | WBYTE(Pkt->dest_port, dest_port); | 591 | WBYTE(Pkt->dest_port, dest_port); |
698 | } | 592 | } |
699 | rio_dprintk (RIO_DEBUG_ROUTE, "phb dest: Old %x:%x New %x:%x\n", | 593 | rio_dprintk(RIO_DEBUG_ROUTE, "phb dest: Old %x:%x New %x:%x\n", RWORD(PortP->PhbP->destination) & 0xff, (RWORD(PortP->PhbP->destination) >> 8) & 0xff, dest_unit, dest_port); |
700 | RWORD(PortP->PhbP->destination) & 0xff, | ||
701 | (RWORD(PortP->PhbP->destination) >> 8) & 0xff, | ||
702 | dest_unit, dest_port); | ||
703 | WWORD(PortP->PhbP->destination, dest_unit + (dest_port << 8)); | 594 | WWORD(PortP->PhbP->destination, dest_unit + (dest_port << 8)); |
704 | WWORD(PortP->PhbP->link, link); | 595 | WWORD(PortP->PhbP->link, link); |
705 | 596 | ||
706 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | 597 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); |
707 | } | 598 | } |
708 | /* | 599 | /* |
709 | ** Now make sure the range of ports to be serviced includes | 600 | ** Now make sure the range of ports to be serviced includes |
710 | ** the 2nd 8 on this 16 port RTA. | 601 | ** the 2nd 8 on this 16 port RTA. |
711 | */ | 602 | */ |
712 | if (link > 3) return; | 603 | if (link > 3) |
604 | return; | ||
713 | if (((unit * 8) + 7) > RWORD(HostP->LinkStrP[link].last_port)) { | 605 | if (((unit * 8) + 7) > RWORD(HostP->LinkStrP[link].last_port)) { |
714 | rio_dprintk (RIO_DEBUG_ROUTE, "last port on host link %d: %d\n", link, (unit * 8) + 7); | 606 | rio_dprintk(RIO_DEBUG_ROUTE, "last port on host link %d: %d\n", link, (unit * 8) + 7); |
715 | WWORD(HostP->LinkStrP[link].last_port, (unit * 8) + 7); | 607 | WWORD(HostP->LinkStrP[link].last_port, (unit * 8) + 7); |
716 | } | 608 | } |
717 | } | 609 | } |
@@ -723,9 +615,8 @@ uint unit; | |||
723 | ** the world about it. This is done to ensure that the configurator | 615 | ** the world about it. This is done to ensure that the configurator |
724 | ** only gets up-to-date information about what is going on. | 616 | ** only gets up-to-date information about what is going on. |
725 | */ | 617 | */ |
726 | static int | 618 | static int RIOCheckIsolated(p, HostP, UnitId) |
727 | RIOCheckIsolated(p, HostP, UnitId) | 619 | struct rio_info *p; |
728 | struct rio_info * p; | ||
729 | struct Host *HostP; | 620 | struct Host *HostP; |
730 | uint UnitId; | 621 | uint UnitId; |
731 | { | 622 | { |
@@ -733,16 +624,16 @@ uint UnitId; | |||
733 | rio_spin_lock_irqsave(&HostP->HostLock, flags); | 624 | rio_spin_lock_irqsave(&HostP->HostLock, flags); |
734 | 625 | ||
735 | #ifdef CHECK | 626 | #ifdef CHECK |
736 | CheckHostP( HostP ); | 627 | CheckHostP(HostP); |
737 | CheckUnitId( UnitId ); | 628 | CheckUnitId(UnitId); |
738 | #endif | 629 | #endif |
739 | if ( RIOCheck( HostP, UnitId ) ) { | 630 | if (RIOCheck(HostP, UnitId)) { |
740 | rio_dprintk (RIO_DEBUG_ROUTE, "Unit %d is NOT isolated\n", UnitId); | 631 | rio_dprintk(RIO_DEBUG_ROUTE, "Unit %d is NOT isolated\n", UnitId); |
741 | rio_spin_unlock_irqrestore(&HostP->HostLock, flags); | 632 | rio_spin_unlock_irqrestore(&HostP->HostLock, flags); |
742 | return(0); | 633 | return (0); |
743 | } | 634 | } |
744 | 635 | ||
745 | RIOIsolate(p, HostP, UnitId ); | 636 | RIOIsolate(p, HostP, UnitId); |
746 | RIOSetChange(p); | 637 | RIOSetChange(p); |
747 | rio_spin_unlock_irqrestore(&HostP->HostLock, flags); | 638 | rio_spin_unlock_irqrestore(&HostP->HostLock, flags); |
748 | return 1; | 639 | return 1; |
@@ -753,85 +644,83 @@ uint UnitId; | |||
753 | ** all the units attached to it. This will mean that the entire | 644 | ** all the units attached to it. This will mean that the entire |
754 | ** subnet will re-introduce itself. | 645 | ** subnet will re-introduce itself. |
755 | */ | 646 | */ |
756 | static int | 647 | static int RIOIsolate(p, HostP, UnitId) |
757 | RIOIsolate(p, HostP, UnitId) | 648 | struct rio_info *p; |
758 | struct rio_info * p; | 649 | struct Host *HostP; |
759 | struct Host * HostP; | 650 | uint UnitId; |
760 | uint UnitId; | ||
761 | { | 651 | { |
762 | uint link, unit; | 652 | uint link, unit; |
763 | 653 | ||
764 | #ifdef CHECK | 654 | #ifdef CHECK |
765 | CheckHostP( HostP ); | 655 | CheckHostP(HostP); |
766 | CheckUnitId( UnitId ); | 656 | CheckUnitId(UnitId); |
767 | #endif | 657 | #endif |
768 | UnitId--; /* this trick relies on the Unit Id being UNSIGNED! */ | 658 | UnitId--; /* this trick relies on the Unit Id being UNSIGNED! */ |
769 | 659 | ||
770 | if ( UnitId >= MAX_RUP ) /* dontcha just lurv unsigned maths! */ | 660 | if (UnitId >= MAX_RUP) /* dontcha just lurv unsigned maths! */ |
771 | return(0); | 661 | return (0); |
772 | 662 | ||
773 | if ( HostP->Mapping[UnitId].Flags & BEEN_HERE ) | 663 | if (HostP->Mapping[UnitId].Flags & BEEN_HERE) |
774 | return(0); | 664 | return (0); |
775 | 665 | ||
776 | HostP->Mapping[UnitId].Flags |= BEEN_HERE; | 666 | HostP->Mapping[UnitId].Flags |= BEEN_HERE; |
777 | 667 | ||
778 | if ( p->RIOPrintDisabled == DO_PRINT ) | 668 | if (p->RIOPrintDisabled == DO_PRINT) |
779 | rio_dprintk (RIO_DEBUG_ROUTE, "RIOMesgIsolated %s", HostP->Mapping[UnitId].Name); | 669 | rio_dprintk(RIO_DEBUG_ROUTE, "RIOMesgIsolated %s", HostP->Mapping[UnitId].Name); |
780 | 670 | ||
781 | for ( link=0; link<LINKS_PER_UNIT; link++) { | 671 | for (link = 0; link < LINKS_PER_UNIT; link++) { |
782 | unit = HostP->Mapping[UnitId].Topology[link].Unit; | 672 | unit = HostP->Mapping[UnitId].Topology[link].Unit; |
783 | HostP->Mapping[UnitId].Topology[link].Unit = ROUTE_DISCONNECT; | 673 | HostP->Mapping[UnitId].Topology[link].Unit = ROUTE_DISCONNECT; |
784 | HostP->Mapping[UnitId].Topology[link].Link = NO_LINK; | 674 | HostP->Mapping[UnitId].Topology[link].Link = NO_LINK; |
785 | RIOIsolate(p, HostP, unit ); | 675 | RIOIsolate(p, HostP, unit); |
786 | } | 676 | } |
787 | HostP->Mapping[UnitId].Flags &= ~BEEN_HERE; | 677 | HostP->Mapping[UnitId].Flags &= ~BEEN_HERE; |
788 | return 1; | 678 | return 1; |
789 | } | 679 | } |
790 | 680 | ||
791 | static int | 681 | static int RIOCheck(HostP, UnitId) |
792 | RIOCheck(HostP, UnitId) | ||
793 | struct Host *HostP; | 682 | struct Host *HostP; |
794 | uint UnitId; | 683 | uint UnitId; |
795 | { | 684 | { |
796 | unsigned char link; | 685 | unsigned char link; |
797 | 686 | ||
798 | #ifdef CHECK | 687 | #ifdef CHECK |
799 | CheckHostP( HostP ); | 688 | CheckHostP(HostP); |
800 | CheckUnitId( UnitId ); | 689 | CheckUnitId(UnitId); |
801 | #endif | 690 | #endif |
802 | /* rio_dprint(RIO_DEBUG_ROUTE, ("Check to see if unit %d has a route to the host\n",UnitId)); */ | 691 | /* rio_dprint(RIO_DEBUG_ROUTE, ("Check to see if unit %d has a route to the host\n",UnitId)); */ |
803 | rio_dprintk (RIO_DEBUG_ROUTE, "RIOCheck : UnitID = %d\n", UnitId); | 692 | rio_dprintk(RIO_DEBUG_ROUTE, "RIOCheck : UnitID = %d\n", UnitId); |
804 | 693 | ||
805 | if ( UnitId == HOST_ID ) { | 694 | if (UnitId == HOST_ID) { |
806 | /* rio_dprint(RIO_DEBUG_ROUTE, ("Unit %d is NOT isolated - it IS the host!\n", UnitId)); */ | 695 | /* rio_dprint(RIO_DEBUG_ROUTE, ("Unit %d is NOT isolated - it IS the host!\n", UnitId)); */ |
807 | return 1; | 696 | return 1; |
808 | } | 697 | } |
809 | 698 | ||
810 | UnitId--; | 699 | UnitId--; |
811 | 700 | ||
812 | if ( UnitId >= MAX_RUP ) { | 701 | if (UnitId >= MAX_RUP) { |
813 | /* rio_dprint(RIO_DEBUG_ROUTE, ("Unit %d - ignored.\n", UnitId)); */ | 702 | /* rio_dprint(RIO_DEBUG_ROUTE, ("Unit %d - ignored.\n", UnitId)); */ |
814 | return 0; | 703 | return 0; |
815 | } | 704 | } |
816 | 705 | ||
817 | for ( link=0; link<LINKS_PER_UNIT; link++ ) { | 706 | for (link = 0; link < LINKS_PER_UNIT; link++) { |
818 | if ( HostP->Mapping[UnitId].Topology[link].Unit==HOST_ID ) { | 707 | if (HostP->Mapping[UnitId].Topology[link].Unit == HOST_ID) { |
819 | /* rio_dprint(RIO_DEBUG_ROUTE, ("Unit %d is connected directly to host via link (%c).\n", | 708 | /* rio_dprint(RIO_DEBUG_ROUTE, ("Unit %d is connected directly to host via link (%c).\n", |
820 | UnitId, 'A'+link)); */ | 709 | UnitId, 'A'+link)); */ |
821 | return 1; | 710 | return 1; |
822 | } | 711 | } |
823 | } | 712 | } |
824 | 713 | ||
825 | if ( HostP->Mapping[UnitId].Flags & BEEN_HERE ) { | 714 | if (HostP->Mapping[UnitId].Flags & BEEN_HERE) { |
826 | /* rio_dprint(RIO_DEBUG_ROUTE, ("Been to Unit %d before - ignoring\n", UnitId)); */ | 715 | /* rio_dprint(RIO_DEBUG_ROUTE, ("Been to Unit %d before - ignoring\n", UnitId)); */ |
827 | return 0; | 716 | return 0; |
828 | } | 717 | } |
829 | 718 | ||
830 | HostP->Mapping[UnitId].Flags |= BEEN_HERE; | 719 | HostP->Mapping[UnitId].Flags |= BEEN_HERE; |
831 | 720 | ||
832 | for ( link=0; link < LINKS_PER_UNIT; link++ ) { | 721 | for (link = 0; link < LINKS_PER_UNIT; link++) { |
833 | /* rio_dprint(RIO_DEBUG_ROUTE, ("Unit %d check link (%c)\n", UnitId,'A'+link)); */ | 722 | /* rio_dprint(RIO_DEBUG_ROUTE, ("Unit %d check link (%c)\n", UnitId,'A'+link)); */ |
834 | if ( RIOCheck( HostP, HostP->Mapping[UnitId].Topology[link].Unit ) ) { | 723 | if (RIOCheck(HostP, HostP->Mapping[UnitId].Topology[link].Unit)) { |
835 | /* rio_dprint(RIO_DEBUG_ROUTE, ("Unit %d is connected to something that knows the host via link (%c)\n", UnitId,link+'A')); */ | 724 | /* rio_dprint(RIO_DEBUG_ROUTE, ("Unit %d is connected to something that knows the host via link (%c)\n", UnitId,link+'A')); */ |
836 | HostP->Mapping[UnitId].Flags &= ~BEEN_HERE; | 725 | HostP->Mapping[UnitId].Flags &= ~BEEN_HERE; |
837 | return 1; | 726 | return 1; |
@@ -841,7 +730,7 @@ uint UnitId; | |||
841 | HostP->Mapping[UnitId].Flags &= ~BEEN_HERE; | 730 | HostP->Mapping[UnitId].Flags &= ~BEEN_HERE; |
842 | 731 | ||
843 | /* rio_dprint(RIO_DEBUG_ROUTE, ("Unit %d DOESNT KNOW THE HOST!\n", UnitId)); */ | 732 | /* rio_dprint(RIO_DEBUG_ROUTE, ("Unit %d DOESNT KNOW THE HOST!\n", UnitId)); */ |
844 | 733 | ||
845 | return 0; | 734 | return 0; |
846 | } | 735 | } |
847 | 736 | ||
@@ -849,61 +738,57 @@ uint UnitId; | |||
849 | ** Returns the type of unit (host, 16/8 port RTA) | 738 | ** Returns the type of unit (host, 16/8 port RTA) |
850 | */ | 739 | */ |
851 | 740 | ||
852 | uint | 741 | uint GetUnitType(Uniq) |
853 | GetUnitType(Uniq) | ||
854 | uint Uniq; | 742 | uint Uniq; |
855 | { | 743 | { |
856 | switch ( (Uniq >> 28) & 0xf) | 744 | switch ((Uniq >> 28) & 0xf) { |
857 | { | 745 | case RIO_AT: |
858 | case RIO_AT: | 746 | case RIO_MCA: |
859 | case RIO_MCA: | 747 | case RIO_EISA: |
860 | case RIO_EISA: | 748 | case RIO_PCI: |
861 | case RIO_PCI: | 749 | rio_dprintk(RIO_DEBUG_ROUTE, "Unit type: Host\n"); |
862 | rio_dprintk (RIO_DEBUG_ROUTE, "Unit type: Host\n"); | 750 | return (TYPE_HOST); |
863 | return(TYPE_HOST); | 751 | case RIO_RTA_16: |
864 | case RIO_RTA_16: | 752 | rio_dprintk(RIO_DEBUG_ROUTE, "Unit type: 16 port RTA\n"); |
865 | rio_dprintk (RIO_DEBUG_ROUTE, "Unit type: 16 port RTA\n"); | 753 | return (TYPE_RTA16); |
866 | return(TYPE_RTA16); | 754 | case RIO_RTA: |
867 | case RIO_RTA: | 755 | rio_dprintk(RIO_DEBUG_ROUTE, "Unit type: 8 port RTA\n"); |
868 | rio_dprintk (RIO_DEBUG_ROUTE, "Unit type: 8 port RTA\n"); | 756 | return (TYPE_RTA8); |
869 | return(TYPE_RTA8); | 757 | default: |
870 | default : | 758 | rio_dprintk(RIO_DEBUG_ROUTE, "Unit type: Unrecognised\n"); |
871 | rio_dprintk (RIO_DEBUG_ROUTE, "Unit type: Unrecognised\n"); | 759 | return (99); |
872 | return(99); | ||
873 | } | 760 | } |
874 | } | 761 | } |
875 | 762 | ||
876 | int | 763 | int RIOSetChange(p) |
877 | RIOSetChange(p) | 764 | struct rio_info *p; |
878 | struct rio_info * p; | ||
879 | { | 765 | { |
880 | if ( p->RIOQuickCheck != NOT_CHANGED ) | 766 | if (p->RIOQuickCheck != NOT_CHANGED) |
881 | return(0); | 767 | return (0); |
882 | p->RIOQuickCheck = CHANGED; | 768 | p->RIOQuickCheck = CHANGED; |
883 | if ( p->RIOSignalProcess ) { | 769 | if (p->RIOSignalProcess) { |
884 | rio_dprintk (RIO_DEBUG_ROUTE, "Send SIG-HUP"); | 770 | rio_dprintk(RIO_DEBUG_ROUTE, "Send SIG-HUP"); |
885 | /* | 771 | /* |
886 | psignal( RIOSignalProcess, SIGHUP ); | 772 | psignal( RIOSignalProcess, SIGHUP ); |
887 | */ | 773 | */ |
888 | } | 774 | } |
889 | return(0); | 775 | return (0); |
890 | } | 776 | } |
891 | 777 | ||
892 | static void | 778 | static void RIOConCon(p, HostP, FromId, FromLink, ToId, ToLink, Change) |
893 | RIOConCon(p, HostP, FromId, FromLink, ToId, ToLink, Change) | 779 | struct rio_info *p; |
894 | struct rio_info * p; | ||
895 | struct Host *HostP; | 780 | struct Host *HostP; |
896 | uint FromId; | 781 | uint FromId; |
897 | uint FromLink; | 782 | uint FromLink; |
898 | uint ToId; | 783 | uint ToId; |
899 | uint ToLink; | 784 | uint ToLink; |
900 | int Change; | 785 | int Change; |
901 | { | 786 | { |
902 | char *FromName; | 787 | char *FromName; |
903 | char *FromType; | 788 | char *FromType; |
904 | char *ToName; | 789 | char *ToName; |
905 | char *ToType; | 790 | char *ToType; |
906 | unsigned int tp; | 791 | unsigned int tp; |
907 | 792 | ||
908 | /* | 793 | /* |
909 | ** 15.10.1998 ARG - ESIL 0759 | 794 | ** 15.10.1998 ARG - ESIL 0759 |
@@ -932,38 +817,32 @@ int Change; | |||
932 | ** rio_info struct - RIORtaDisCons (RIO RTA connections) keeps track of RTA | 817 | ** rio_info struct - RIORtaDisCons (RIO RTA connections) keeps track of RTA |
933 | ** connections and disconnections. | 818 | ** connections and disconnections. |
934 | */ | 819 | */ |
935 | if (Change == CONNECT) { | 820 | if (Change == CONNECT) { |
936 | if (p->RIORtaDisCons) p->RIORtaDisCons--; | 821 | if (p->RIORtaDisCons) |
937 | } | 822 | p->RIORtaDisCons--; |
938 | else { | 823 | } else { |
939 | p->RIORtaDisCons++; | 824 | p->RIORtaDisCons++; |
940 | } | 825 | } |
941 | 826 | ||
942 | if ( p->RIOPrintDisabled == DONT_PRINT ) | 827 | if (p->RIOPrintDisabled == DONT_PRINT) |
943 | return; | 828 | return; |
944 | 829 | ||
945 | if ( FromId > ToId ) { | 830 | if (FromId > ToId) { |
946 | tp = FromId; | 831 | tp = FromId; |
947 | FromId = ToId; | 832 | FromId = ToId; |
948 | ToId = tp; | 833 | ToId = tp; |
949 | tp = FromLink; | 834 | tp = FromLink; |
950 | FromLink = ToLink; | 835 | FromLink = ToLink; |
951 | ToLink = tp; | 836 | ToLink = tp; |
952 | } | 837 | } |
953 | 838 | ||
954 | FromName = FromId ? HostP->Mapping[FromId-1].Name : HostP->Name; | 839 | FromName = FromId ? HostP->Mapping[FromId - 1].Name : HostP->Name; |
955 | FromType = FromId ? "RTA" : "HOST"; | 840 | FromType = FromId ? "RTA" : "HOST"; |
956 | ToName = ToId ? HostP->Mapping[ToId-1].Name : HostP->Name; | 841 | ToName = ToId ? HostP->Mapping[ToId - 1].Name : HostP->Name; |
957 | ToType = ToId ? "RTA" : "HOST"; | 842 | ToType = ToId ? "RTA" : "HOST"; |
958 | 843 | ||
959 | rio_dprintk (RIO_DEBUG_ROUTE, "Link between %s '%s' (%c) and %s '%s' (%c) %s.\n", | 844 | 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"); |
960 | FromType, FromName, 'A'+FromLink, | 845 | cprintf("Link between %s '%s' (%c) and %s '%s' (%c) %s.\n", FromType, FromName, 'A' + FromLink, ToType, ToName, 'A' + ToLink, (Change == CONNECT) ? "established" : "disconnected"); |
961 | ToType, ToName, 'A'+ToLink, | ||
962 | (Change==CONNECT) ? "established" : "disconnected"); | ||
963 | cprintf("Link between %s '%s' (%c) and %s '%s' (%c) %s.\n", | ||
964 | FromType, FromName, 'A'+FromLink, | ||
965 | ToType, ToName, 'A'+ToLink, | ||
966 | (Change==CONNECT) ? "established" : "disconnected"); | ||
967 | } | 846 | } |
968 | 847 | ||
969 | /* | 848 | /* |
@@ -972,24 +851,21 @@ int Change; | |||
972 | ** Delete and RTA entry from the saved table given to us | 851 | ** Delete and RTA entry from the saved table given to us |
973 | ** by the configuration program. | 852 | ** by the configuration program. |
974 | */ | 853 | */ |
975 | static int | 854 | static int RIORemoveFromSavedTable(struct rio_info *p, struct Map *pMap) |
976 | RIORemoveFromSavedTable(struct rio_info *p, struct Map *pMap) | ||
977 | { | 855 | { |
978 | int entry; | 856 | int entry; |
979 | 857 | ||
980 | /* | 858 | /* |
981 | ** We loop for all entries even after finding an entry and | 859 | ** We loop for all entries even after finding an entry and |
982 | ** zeroing it because we may have two entries to delete if | 860 | ** zeroing it because we may have two entries to delete if |
983 | ** it's a 16 port RTA. | 861 | ** it's a 16 port RTA. |
984 | */ | 862 | */ |
985 | for (entry = 0; entry < TOTAL_MAP_ENTRIES; entry++) | 863 | for (entry = 0; entry < TOTAL_MAP_ENTRIES; entry++) { |
986 | { | 864 | if (p->RIOSavedTable[entry].RtaUniqueNum == pMap->RtaUniqueNum) { |
987 | if (p->RIOSavedTable[entry].RtaUniqueNum == pMap->RtaUniqueNum) | 865 | bzero((caddr_t) & p->RIOSavedTable[entry], sizeof(struct Map)); |
988 | { | 866 | } |
989 | bzero((caddr_t)&p->RIOSavedTable[entry], sizeof(struct Map)); | ||
990 | } | 867 | } |
991 | } | 868 | return 0; |
992 | return 0; | ||
993 | } | 869 | } |
994 | 870 | ||
995 | 871 | ||
@@ -999,64 +875,58 @@ RIORemoveFromSavedTable(struct rio_info *p, struct Map *pMap) | |||
999 | ** Scan the unit links to and return zero if the unit is completely | 875 | ** Scan the unit links to and return zero if the unit is completely |
1000 | ** disconnected. | 876 | ** disconnected. |
1001 | */ | 877 | */ |
1002 | static int | 878 | static int RIOFreeDisconnected(struct rio_info *p, struct Host *HostP, int unit) |
1003 | RIOFreeDisconnected(struct rio_info *p, struct Host *HostP, int unit) | ||
1004 | { | 879 | { |
1005 | int link; | 880 | int link; |
1006 | 881 | ||
1007 | 882 | ||
1008 | rio_dprintk (RIO_DEBUG_ROUTE, "RIOFreeDisconnect unit %d\n", unit); | 883 | rio_dprintk(RIO_DEBUG_ROUTE, "RIOFreeDisconnect unit %d\n", unit); |
1009 | /* | 884 | /* |
1010 | ** If the slot is tentative and does not belong to the | 885 | ** If the slot is tentative and does not belong to the |
1011 | ** second half of a 16 port RTA then scan to see if | 886 | ** second half of a 16 port RTA then scan to see if |
1012 | ** is disconnected. | 887 | ** is disconnected. |
1013 | */ | 888 | */ |
1014 | for (link = 0; link < LINKS_PER_UNIT; link++) | 889 | for (link = 0; link < LINKS_PER_UNIT; link++) { |
1015 | { | 890 | if (HostP->Mapping[unit].Topology[link].Unit != ROUTE_DISCONNECT) |
1016 | if (HostP->Mapping[unit].Topology[link].Unit != ROUTE_DISCONNECT) | 891 | break; |
1017 | break; | 892 | } |
1018 | } | 893 | |
1019 | 894 | /* | |
1020 | /* | 895 | ** If not all links are disconnected then we can forget about it. |
1021 | ** If not all links are disconnected then we can forget about it. | 896 | */ |
1022 | */ | 897 | if (link < LINKS_PER_UNIT) |
1023 | if (link < LINKS_PER_UNIT) | 898 | return 1; |
1024 | return 1; | ||
1025 | 899 | ||
1026 | #ifdef NEED_TO_FIX_THIS | 900 | #ifdef NEED_TO_FIX_THIS |
1027 | /* Ok so all the links are disconnected. But we may have only just | 901 | /* Ok so all the links are disconnected. But we may have only just |
1028 | ** made this slot tentative and not yet received a topology update. | 902 | ** made this slot tentative and not yet received a topology update. |
1029 | ** Lets check how long ago we made it tentative. | 903 | ** Lets check how long ago we made it tentative. |
1030 | */ | 904 | */ |
1031 | rio_dprintk (RIO_DEBUG_ROUTE, "Just about to check LBOLT on entry %d\n", unit); | 905 | rio_dprintk(RIO_DEBUG_ROUTE, "Just about to check LBOLT on entry %d\n", unit); |
1032 | if (drv_getparm(LBOLT, (ulong_t *) ¤t_time)) | 906 | if (drv_getparm(LBOLT, (ulong_t *) & current_time)) |
1033 | rio_dprintk (RIO_DEBUG_ROUTE, "drv_getparm(LBOLT,....) Failed.\n"); | 907 | rio_dprintk(RIO_DEBUG_ROUTE, "drv_getparm(LBOLT,....) Failed.\n"); |
1034 | 908 | ||
1035 | elapse_time = current_time - TentTime[unit]; | 909 | elapse_time = current_time - TentTime[unit]; |
1036 | rio_dprintk (RIO_DEBUG_ROUTE, "elapse %d = current %d - tent %d (%d usec)\n", | 910 | rio_dprintk(RIO_DEBUG_ROUTE, "elapse %d = current %d - tent %d (%d usec)\n", elapse_time, current_time, TentTime[unit], drv_hztousec(elapse_time)); |
1037 | elapse_time, current_time, TentTime[unit], drv_hztousec(elapse_time)); | 911 | if (drv_hztousec(elapse_time) < WAIT_TO_FINISH) { |
1038 | if (drv_hztousec(elapse_time) < WAIT_TO_FINISH) | 912 | rio_dprintk(RIO_DEBUG_ROUTE, "Skipping slot %d, not timed out yet %d\n", unit, drv_hztousec(elapse_time)); |
1039 | { | 913 | return 1; |
1040 | rio_dprintk (RIO_DEBUG_ROUTE, "Skipping slot %d, not timed out yet %d\n", | 914 | } |
1041 | unit, drv_hztousec(elapse_time)); | ||
1042 | return 1; | ||
1043 | } | ||
1044 | #endif | 915 | #endif |
1045 | 916 | ||
1046 | /* | 917 | /* |
1047 | ** We have found an usable slot. | 918 | ** We have found an usable slot. |
1048 | ** If it is half of a 16 port RTA then delete the other half. | 919 | ** If it is half of a 16 port RTA then delete the other half. |
1049 | */ | 920 | */ |
1050 | if (HostP->Mapping[unit].ID2 != 0) | 921 | if (HostP->Mapping[unit].ID2 != 0) { |
1051 | { | 922 | int nOther = (HostP->Mapping[unit].ID2) - 1; |
1052 | int nOther = (HostP->Mapping[unit].ID2) -1; | 923 | |
1053 | 924 | rio_dprintk(RIO_DEBUG_ROUTE, "RioFreedis second slot %d.\n", nOther); | |
1054 | rio_dprintk (RIO_DEBUG_ROUTE, "RioFreedis second slot %d.\n", nOther); | 925 | bzero((caddr_t) & HostP->Mapping[nOther], sizeof(struct Map)); |
1055 | bzero((caddr_t)&HostP->Mapping[nOther], sizeof(struct Map)); | 926 | } |
1056 | } | 927 | RIORemoveFromSavedTable(p, &HostP->Mapping[unit]); |
1057 | RIORemoveFromSavedTable(p, &HostP->Mapping[unit]); | ||
1058 | 928 | ||
1059 | return 0; | 929 | return 0; |
1060 | } | 930 | } |
1061 | 931 | ||
1062 | 932 | ||
@@ -1066,150 +936,134 @@ RIOFreeDisconnected(struct rio_info *p, struct Host *HostP, int unit) | |||
1066 | ** This function scans the given host table for either one | 936 | ** This function scans the given host table for either one |
1067 | ** or two free unit ID's. | 937 | ** or two free unit ID's. |
1068 | */ | 938 | */ |
1069 | int | 939 | int RIOFindFreeID(struct rio_info *p, struct Host *HostP, uint * pID1, uint * pID2) |
1070 | RIOFindFreeID(struct rio_info *p, struct Host *HostP, uint *pID1, uint *pID2) | ||
1071 | { | 940 | { |
1072 | int unit,tempID; | 941 | int unit, tempID; |
1073 | 942 | ||
1074 | /* | ||
1075 | ** Initialise the ID's to MAX_RUP. | ||
1076 | ** We do this to make the loop for setting the ID's as simple as | ||
1077 | ** possible. | ||
1078 | */ | ||
1079 | *pID1 = MAX_RUP; | ||
1080 | if (pID2 != NULL) | ||
1081 | *pID2 = MAX_RUP; | ||
1082 | |||
1083 | /* | ||
1084 | ** Scan all entries of the host mapping table for free slots. | ||
1085 | ** We scan for free slots first and then if that is not successful | ||
1086 | ** we start all over again looking for tentative slots we can re-use. | ||
1087 | */ | ||
1088 | for (unit = 0; unit < MAX_RUP; unit++) | ||
1089 | { | ||
1090 | rio_dprintk (RIO_DEBUG_ROUTE, "Scanning unit %d\n",unit); | ||
1091 | /* | 943 | /* |
1092 | ** If the flags are zero then the slot is empty. | 944 | ** Initialise the ID's to MAX_RUP. |
1093 | */ | 945 | ** We do this to make the loop for setting the ID's as simple as |
1094 | if (HostP->Mapping[unit].Flags == 0) | 946 | ** possible. |
1095 | { | 947 | */ |
1096 | rio_dprintk (RIO_DEBUG_ROUTE, " This slot is empty.\n"); | 948 | *pID1 = MAX_RUP; |
1097 | /* | 949 | if (pID2 != NULL) |
1098 | ** If we haven't allocated the first ID then do it now. | 950 | *pID2 = MAX_RUP; |
1099 | */ | ||
1100 | if (*pID1 == MAX_RUP) | ||
1101 | { | ||
1102 | rio_dprintk (RIO_DEBUG_ROUTE, "Make tentative entry for first unit %d\n", unit); | ||
1103 | *pID1 = unit; | ||
1104 | 951 | ||
952 | /* | ||
953 | ** Scan all entries of the host mapping table for free slots. | ||
954 | ** We scan for free slots first and then if that is not successful | ||
955 | ** we start all over again looking for tentative slots we can re-use. | ||
956 | */ | ||
957 | for (unit = 0; unit < MAX_RUP; unit++) { | ||
958 | rio_dprintk(RIO_DEBUG_ROUTE, "Scanning unit %d\n", unit); | ||
1105 | /* | 959 | /* |
1106 | ** If the second ID is not needed then we can return | 960 | ** If the flags are zero then the slot is empty. |
1107 | ** now. | 961 | */ |
1108 | */ | 962 | if (HostP->Mapping[unit].Flags == 0) { |
1109 | if (pID2 == NULL) | 963 | rio_dprintk(RIO_DEBUG_ROUTE, " This slot is empty.\n"); |
1110 | return 0; | 964 | /* |
1111 | } | 965 | ** If we haven't allocated the first ID then do it now. |
1112 | else | 966 | */ |
1113 | { | 967 | if (*pID1 == MAX_RUP) { |
1114 | /* | 968 | rio_dprintk(RIO_DEBUG_ROUTE, "Make tentative entry for first unit %d\n", unit); |
1115 | ** Allocate the second slot and return. | 969 | *pID1 = unit; |
1116 | */ | 970 | |
1117 | rio_dprintk (RIO_DEBUG_ROUTE, "Make tentative entry for second unit %d\n", unit); | 971 | /* |
1118 | *pID2 = unit; | 972 | ** If the second ID is not needed then we can return |
1119 | return 0; | 973 | ** now. |
1120 | } | 974 | */ |
975 | if (pID2 == NULL) | ||
976 | return 0; | ||
977 | } else { | ||
978 | /* | ||
979 | ** Allocate the second slot and return. | ||
980 | */ | ||
981 | rio_dprintk(RIO_DEBUG_ROUTE, "Make tentative entry for second unit %d\n", unit); | ||
982 | *pID2 = unit; | ||
983 | return 0; | ||
984 | } | ||
985 | } | ||
1121 | } | 986 | } |
1122 | } | ||
1123 | |||
1124 | /* | ||
1125 | ** If we manage to come out of the free slot loop then we | ||
1126 | ** need to start all over again looking for tentative slots | ||
1127 | ** that we can re-use. | ||
1128 | */ | ||
1129 | rio_dprintk (RIO_DEBUG_ROUTE, "Starting to scan for tentative slots\n"); | ||
1130 | for (unit = 0; unit < MAX_RUP; unit++) | ||
1131 | { | ||
1132 | if (((HostP->Mapping[unit].Flags & SLOT_TENTATIVE) || | ||
1133 | (HostP->Mapping[unit].Flags == 0)) && ! | ||
1134 | (HostP->Mapping[unit].Flags & RTA16_SECOND_SLOT )) | ||
1135 | { | ||
1136 | rio_dprintk (RIO_DEBUG_ROUTE, " Slot %d looks promising.\n",unit); | ||
1137 | |||
1138 | if(unit == *pID1) | ||
1139 | { | ||
1140 | rio_dprintk (RIO_DEBUG_ROUTE, " No it isn't, its the 1st half\n"); | ||
1141 | continue; | ||
1142 | } | ||
1143 | |||
1144 | /* | ||
1145 | ** Slot is Tentative or Empty, but not a tentative second | ||
1146 | ** slot of a 16 porter. | ||
1147 | ** Attempt to free up this slot (and its parnter if | ||
1148 | ** it is a 16 port slot. The second slot will become | ||
1149 | ** empty after a call to RIOFreeDisconnected so thats why | ||
1150 | ** we look for empty slots above as well). | ||
1151 | */ | ||
1152 | if (HostP->Mapping[unit].Flags != 0) | ||
1153 | if (RIOFreeDisconnected(p, HostP, unit) != 0) | ||
1154 | continue; | ||
1155 | /* | ||
1156 | ** If we haven't allocated the first ID then do it now. | ||
1157 | */ | ||
1158 | if (*pID1 == MAX_RUP) | ||
1159 | { | ||
1160 | rio_dprintk (RIO_DEBUG_ROUTE, "Grab tentative entry for first unit %d\n", unit); | ||
1161 | *pID1 = unit; | ||
1162 | 987 | ||
1163 | /* | 988 | /* |
1164 | ** Clear out this slot now that we intend to use it. | 989 | ** If we manage to come out of the free slot loop then we |
1165 | */ | 990 | ** need to start all over again looking for tentative slots |
1166 | bzero(&HostP->Mapping[unit], sizeof(struct Map)); | 991 | ** that we can re-use. |
992 | */ | ||
993 | rio_dprintk(RIO_DEBUG_ROUTE, "Starting to scan for tentative slots\n"); | ||
994 | for (unit = 0; unit < MAX_RUP; unit++) { | ||
995 | if (((HostP->Mapping[unit].Flags & SLOT_TENTATIVE) || (HostP->Mapping[unit].Flags == 0)) && !(HostP->Mapping[unit].Flags & RTA16_SECOND_SLOT)) { | ||
996 | rio_dprintk(RIO_DEBUG_ROUTE, " Slot %d looks promising.\n", unit); | ||
997 | |||
998 | if (unit == *pID1) { | ||
999 | rio_dprintk(RIO_DEBUG_ROUTE, " No it isn't, its the 1st half\n"); | ||
1000 | continue; | ||
1001 | } | ||
1167 | 1002 | ||
1168 | /* | 1003 | /* |
1169 | ** If the second ID is not needed then we can return | 1004 | ** Slot is Tentative or Empty, but not a tentative second |
1170 | ** now. | 1005 | ** slot of a 16 porter. |
1171 | */ | 1006 | ** Attempt to free up this slot (and its parnter if |
1172 | if (pID2 == NULL) | 1007 | ** it is a 16 port slot. The second slot will become |
1173 | return 0; | 1008 | ** empty after a call to RIOFreeDisconnected so thats why |
1174 | } | 1009 | ** we look for empty slots above as well). |
1175 | else | 1010 | */ |
1176 | { | 1011 | if (HostP->Mapping[unit].Flags != 0) |
1177 | /* | 1012 | if (RIOFreeDisconnected(p, HostP, unit) != 0) |
1178 | ** Allocate the second slot and return. | 1013 | continue; |
1179 | */ | 1014 | /* |
1180 | rio_dprintk (RIO_DEBUG_ROUTE, "Grab tentative/empty entry for second unit %d\n", | 1015 | ** If we haven't allocated the first ID then do it now. |
1181 | unit); | 1016 | */ |
1182 | *pID2 = unit; | 1017 | if (*pID1 == MAX_RUP) { |
1018 | rio_dprintk(RIO_DEBUG_ROUTE, "Grab tentative entry for first unit %d\n", unit); | ||
1019 | *pID1 = unit; | ||
1183 | 1020 | ||
1184 | /* | 1021 | /* |
1185 | ** Clear out this slot now that we intend to use it. | 1022 | ** Clear out this slot now that we intend to use it. |
1186 | */ | 1023 | */ |
1187 | bzero(&HostP->Mapping[unit], sizeof(struct Map)); | 1024 | bzero(&HostP->Mapping[unit], sizeof(struct Map)); |
1188 | 1025 | ||
1189 | /* At this point under the right(wrong?) conditions | 1026 | /* |
1190 | ** we may have a first unit ID being higher than the | 1027 | ** If the second ID is not needed then we can return |
1191 | ** second unit ID. This is a bad idea if we are about | 1028 | ** now. |
1192 | ** to fill the slots with a 16 port RTA. | 1029 | */ |
1193 | ** Better check and swap them over. | 1030 | if (pID2 == NULL) |
1194 | */ | 1031 | return 0; |
1195 | 1032 | } else { | |
1196 | if (*pID1 > *pID2) | 1033 | /* |
1197 | { | 1034 | ** Allocate the second slot and return. |
1198 | rio_dprintk (RIO_DEBUG_ROUTE, "Swapping IDS %d %d\n", *pID1, *pID2); | 1035 | */ |
1199 | tempID = *pID1; | 1036 | rio_dprintk(RIO_DEBUG_ROUTE, "Grab tentative/empty entry for second unit %d\n", unit); |
1200 | *pID1 = *pID2; | 1037 | *pID2 = unit; |
1201 | *pID2 = tempID; | 1038 | |
1039 | /* | ||
1040 | ** Clear out this slot now that we intend to use it. | ||
1041 | */ | ||
1042 | bzero(&HostP->Mapping[unit], sizeof(struct Map)); | ||
1043 | |||
1044 | /* At this point under the right(wrong?) conditions | ||
1045 | ** we may have a first unit ID being higher than the | ||
1046 | ** second unit ID. This is a bad idea if we are about | ||
1047 | ** to fill the slots with a 16 port RTA. | ||
1048 | ** Better check and swap them over. | ||
1049 | */ | ||
1050 | |||
1051 | if (*pID1 > *pID2) { | ||
1052 | rio_dprintk(RIO_DEBUG_ROUTE, "Swapping IDS %d %d\n", *pID1, *pID2); | ||
1053 | tempID = *pID1; | ||
1054 | *pID1 = *pID2; | ||
1055 | *pID2 = tempID; | ||
1056 | } | ||
1057 | return 0; | ||
1058 | } | ||
1202 | } | 1059 | } |
1203 | return 0; | ||
1204 | } | ||
1205 | } | 1060 | } |
1206 | } | ||
1207 | 1061 | ||
1208 | /* | 1062 | /* |
1209 | ** If we manage to get to the end of the second loop then we | 1063 | ** If we manage to get to the end of the second loop then we |
1210 | ** can give up and return a failure. | 1064 | ** can give up and return a failure. |
1211 | */ | 1065 | */ |
1212 | return 1; | 1066 | return 1; |
1213 | } | 1067 | } |
1214 | 1068 | ||
1215 | 1069 | ||
diff --git a/drivers/char/rio/riospace.h b/drivers/char/rio/riospace.h index 32b09b0f23aa..534f1f5b9f53 100644 --- a/drivers/char/rio/riospace.h +++ b/drivers/char/rio/riospace.h | |||
@@ -47,9 +47,8 @@ static char *_riospace_h_sccs_ = "@(#)riospace.h 1.2"; | |||
47 | ** In particular, it won't be able to see changes to RIO_SLOTS | 47 | ** In particular, it won't be able to see changes to RIO_SLOTS |
48 | */ | 48 | */ |
49 | 49 | ||
50 | struct Conf | 50 | struct Conf { |
51 | { | 51 | char Locator[24]; |
52 | char Locator[24]; | ||
53 | unsigned int StartupTime; | 52 | unsigned int StartupTime; |
54 | unsigned int SlowCook; | 53 | unsigned int SlowCook; |
55 | unsigned int IntrPollTime; | 54 | unsigned int IntrPollTime; |
@@ -59,8 +58,8 @@ struct Conf | |||
59 | unsigned int HostLoadBase; | 58 | unsigned int HostLoadBase; |
60 | unsigned int XpHz; | 59 | unsigned int XpHz; |
61 | unsigned int XpCps; | 60 | unsigned int XpCps; |
62 | char *XpOn; | 61 | char *XpOn; |
63 | char *XpOff; | 62 | char *XpOff; |
64 | unsigned int MaxXpCps; | 63 | unsigned int MaxXpCps; |
65 | unsigned int MinXpCps; | 64 | unsigned int MinXpCps; |
66 | unsigned int SpinCmds; | 65 | unsigned int SpinCmds; |
@@ -74,7 +73,7 @@ struct Conf | |||
74 | 73 | ||
75 | /* | 74 | /* |
76 | ** Board types - these MUST correspond to product codes! | 75 | ** Board types - these MUST correspond to product codes! |
77 | */ | 76 | */ |
78 | #define RIO_EMPTY 0x0 | 77 | #define RIO_EMPTY 0x0 |
79 | #define RIO_EISA 0x3 | 78 | #define RIO_EISA 0x3 |
80 | #define RIO_RTA_16 0x9 | 79 | #define RIO_RTA_16 0x9 |
@@ -86,18 +85,16 @@ struct Conf | |||
86 | /* | 85 | /* |
87 | ** Board data structure. This is used for configuration info | 86 | ** Board data structure. This is used for configuration info |
88 | */ | 87 | */ |
89 | struct Brd | 88 | struct Brd { |
90 | { | 89 | unsigned char Type; /* RIO_EISA, RIO_MCA, RIO_AT, RIO_EMPTY... */ |
91 | unsigned char Type; /* RIO_EISA, RIO_MCA, RIO_AT, RIO_EMPTY... */ | 90 | unsigned char Ivec; /* POLLED or ivec number */ |
92 | unsigned char Ivec; /* POLLED or ivec number */ | 91 | unsigned char Mode; /* Control stuff, see below */ |
93 | unsigned char Mode; /* Control stuff, see below */ | ||
94 | }; | 92 | }; |
95 | 93 | ||
96 | struct Board | 94 | struct Board { |
97 | { | 95 | char Locator[RIO_LOCATOR_LEN]; |
98 | char Locator[RIO_LOCATOR_LEN]; | 96 | int NumSlots; |
99 | int NumSlots; | 97 | struct Brd Boards[MAX_RIO_BOARDS]; |
100 | struct Brd Boards[MAX_RIO_BOARDS]; | ||
101 | }; | 98 | }; |
102 | 99 | ||
103 | #define BOOT_FROM_LINK 0x00 | 100 | #define BOOT_FROM_LINK 0x00 |
@@ -158,4 +155,4 @@ struct Board | |||
158 | 155 | ||
159 | #define DBG_ALWAYS 0x80000000 | 156 | #define DBG_ALWAYS 0x80000000 |
160 | 157 | ||
161 | #endif /* __rio_riospace_h__ */ | 158 | #endif /* __rio_riospace_h__ */ |
diff --git a/drivers/char/rio/riotable.c b/drivers/char/rio/riotable.c index e45bc275907a..42c3dffcbbb2 100644 --- a/drivers/char/rio/riotable.c +++ b/drivers/char/rio/riotable.c | |||
@@ -91,9 +91,8 @@ static char *_riotable_c_sccs_ = "@(#)riotable.c 1.2"; | |||
91 | ** A configuration table has been loaded. It is now up to us | 91 | ** A configuration table has been loaded. It is now up to us |
92 | ** to sort it out and use the information contained therein. | 92 | ** to sort it out and use the information contained therein. |
93 | */ | 93 | */ |
94 | int | 94 | int RIONewTable(p) |
95 | RIONewTable(p) | 95 | struct rio_info *p; |
96 | struct rio_info * p; | ||
97 | { | 96 | { |
98 | int Host, Host1, Host2, NameIsUnique, Entry, SubEnt; | 97 | int Host, Host1, Host2, NameIsUnique, Entry, SubEnt; |
99 | struct Map *MapP; | 98 | struct Map *MapP; |
@@ -103,26 +102,26 @@ struct rio_info * p; | |||
103 | char *cptr; | 102 | char *cptr; |
104 | 103 | ||
105 | /* | 104 | /* |
106 | ** We have been sent a new table to install. We need to break | 105 | ** We have been sent a new table to install. We need to break |
107 | ** it down into little bits and spread it around a bit to see | 106 | ** it down into little bits and spread it around a bit to see |
108 | ** what we have got. | 107 | ** what we have got. |
109 | */ | 108 | */ |
110 | /* | 109 | /* |
111 | ** Things to check: | 110 | ** Things to check: |
112 | ** (things marked 'xx' aren't checked any more!) | 111 | ** (things marked 'xx' aren't checked any more!) |
113 | ** (1) That there are no booted Hosts/RTAs out there. | 112 | ** (1) That there are no booted Hosts/RTAs out there. |
114 | ** (2) That the names are properly formed | 113 | ** (2) That the names are properly formed |
115 | ** (3) That blank entries really are. | 114 | ** (3) That blank entries really are. |
116 | ** xx (4) That hosts mentioned in the table actually exist. xx | 115 | ** xx (4) That hosts mentioned in the table actually exist. xx |
117 | ** (5) That the IDs are unique (per host). | 116 | ** (5) That the IDs are unique (per host). |
118 | ** (6) That host IDs are zero | 117 | ** (6) That host IDs are zero |
119 | ** (7) That port numbers are valid | 118 | ** (7) That port numbers are valid |
120 | ** (8) That port numbers aren't duplicated | 119 | ** (8) That port numbers aren't duplicated |
121 | ** (9) That names aren't duplicated | 120 | ** (9) That names aren't duplicated |
122 | ** xx (10) That hosts that actually exist are mentioned in the table. xx | 121 | ** xx (10) That hosts that actually exist are mentioned in the table. xx |
123 | */ | 122 | */ |
124 | rio_dprintk (RIO_DEBUG_TABLE, "RIONewTable: entering(1)\n"); | 123 | rio_dprintk(RIO_DEBUG_TABLE, "RIONewTable: entering(1)\n"); |
125 | if ( p->RIOSystemUp ) { /* (1) */ | 124 | if (p->RIOSystemUp) { /* (1) */ |
126 | p->RIOError.Error = HOST_HAS_ALREADY_BEEN_BOOTED; | 125 | p->RIOError.Error = HOST_HAS_ALREADY_BEEN_BOOTED; |
127 | return -EBUSY; | 126 | return -EBUSY; |
128 | } | 127 | } |
@@ -131,19 +130,19 @@ struct rio_info * p; | |||
131 | p->RIOError.Entry = -1; | 130 | p->RIOError.Entry = -1; |
132 | p->RIOError.Other = -1; | 131 | p->RIOError.Other = -1; |
133 | 132 | ||
134 | for ( Entry=0; Entry<TOTAL_MAP_ENTRIES; Entry++ ) { | 133 | for (Entry = 0; Entry < TOTAL_MAP_ENTRIES; Entry++) { |
135 | MapP = &p->RIOConnectTable[Entry]; | 134 | MapP = &p->RIOConnectTable[Entry]; |
136 | if ((MapP->Flags & RTA16_SECOND_SLOT) == 0) { | 135 | if ((MapP->Flags & RTA16_SECOND_SLOT) == 0) { |
137 | rio_dprintk (RIO_DEBUG_TABLE, "RIONewTable: entering(2)\n"); | 136 | rio_dprintk(RIO_DEBUG_TABLE, "RIONewTable: entering(2)\n"); |
138 | cptr = MapP->Name; /* (2) */ | 137 | cptr = MapP->Name; /* (2) */ |
139 | cptr[MAX_NAME_LEN-1]='\0'; | 138 | cptr[MAX_NAME_LEN - 1] = '\0'; |
140 | if ( cptr[0]=='\0' ) { | 139 | if (cptr[0] == '\0') { |
141 | bcopy(MapP->RtaUniqueNum?"RTA NN":"HOST NN",MapP->Name,8); | 140 | bcopy(MapP->RtaUniqueNum ? "RTA NN" : "HOST NN", MapP->Name, 8); |
142 | MapP->Name[5] = '0'+Entry/10; | 141 | MapP->Name[5] = '0' + Entry / 10; |
143 | MapP->Name[6] = '0'+Entry%10; | 142 | MapP->Name[6] = '0' + Entry % 10; |
144 | } | 143 | } |
145 | while ( *cptr ) { | 144 | while (*cptr) { |
146 | if ( *cptr<' ' || *cptr>'~' ) { | 145 | if (*cptr < ' ' || *cptr > '~') { |
147 | p->RIOError.Error = BAD_CHARACTER_IN_NAME; | 146 | p->RIOError.Error = BAD_CHARACTER_IN_NAME; |
148 | p->RIOError.Entry = Entry; | 147 | p->RIOError.Entry = Entry; |
149 | return -ENXIO; | 148 | return -ENXIO; |
@@ -153,133 +152,119 @@ struct rio_info * p; | |||
153 | } | 152 | } |
154 | 153 | ||
155 | /* | 154 | /* |
156 | ** If the entry saved was a tentative entry then just forget | 155 | ** If the entry saved was a tentative entry then just forget |
157 | ** about it. | 156 | ** about it. |
158 | */ | 157 | */ |
159 | if ( MapP->Flags & SLOT_TENTATIVE ) { | 158 | if (MapP->Flags & SLOT_TENTATIVE) { |
160 | MapP->HostUniqueNum = 0; | 159 | MapP->HostUniqueNum = 0; |
161 | MapP->RtaUniqueNum = 0; | 160 | MapP->RtaUniqueNum = 0; |
162 | continue; | 161 | continue; |
163 | } | 162 | } |
164 | 163 | ||
165 | rio_dprintk (RIO_DEBUG_TABLE, "RIONewTable: entering(3)\n"); | 164 | rio_dprintk(RIO_DEBUG_TABLE, "RIONewTable: entering(3)\n"); |
166 | if ( !MapP->RtaUniqueNum && !MapP->HostUniqueNum ) { /* (3) */ | 165 | if (!MapP->RtaUniqueNum && !MapP->HostUniqueNum) { /* (3) */ |
167 | if ( MapP->ID || MapP->SysPort || MapP->Flags ) { | 166 | if (MapP->ID || MapP->SysPort || MapP->Flags) { |
168 | rio_dprintk (RIO_DEBUG_TABLE, "%s pretending to be empty but isn't\n",MapP->Name); | 167 | rio_dprintk(RIO_DEBUG_TABLE, "%s pretending to be empty but isn't\n", MapP->Name); |
169 | p->RIOError.Error = TABLE_ENTRY_ISNT_PROPERLY_NULL; | 168 | p->RIOError.Error = TABLE_ENTRY_ISNT_PROPERLY_NULL; |
170 | p->RIOError.Entry = Entry; | 169 | p->RIOError.Entry = Entry; |
171 | return -ENXIO; | 170 | return -ENXIO; |
172 | } | 171 | } |
173 | rio_dprintk (RIO_DEBUG_TABLE, "!RIO: Daemon: test (3) passes\n"); | 172 | rio_dprintk(RIO_DEBUG_TABLE, "!RIO: Daemon: test (3) passes\n"); |
174 | continue; | 173 | continue; |
175 | } | 174 | } |
176 | 175 | ||
177 | rio_dprintk (RIO_DEBUG_TABLE, "RIONewTable: entering(4)\n"); | 176 | rio_dprintk(RIO_DEBUG_TABLE, "RIONewTable: entering(4)\n"); |
178 | for ( Host=0; Host<p->RIONumHosts; Host++ ) { /* (4) */ | 177 | for (Host = 0; Host < p->RIONumHosts; Host++) { /* (4) */ |
179 | if ( p->RIOHosts[Host].UniqueNum==MapP->HostUniqueNum ) { | 178 | if (p->RIOHosts[Host].UniqueNum == MapP->HostUniqueNum) { |
180 | HostP = &p->RIOHosts[Host]; | 179 | HostP = &p->RIOHosts[Host]; |
181 | /* | 180 | /* |
182 | ** having done the lookup, we don't really want to do | 181 | ** having done the lookup, we don't really want to do |
183 | ** it again, so hang the host number in a safe place | 182 | ** it again, so hang the host number in a safe place |
184 | */ | 183 | */ |
185 | MapP->Topology[0].Unit = Host; | 184 | MapP->Topology[0].Unit = Host; |
186 | break; | 185 | break; |
187 | } | 186 | } |
188 | } | 187 | } |
189 | 188 | ||
190 | if ( Host >= p->RIONumHosts ) { | 189 | if (Host >= p->RIONumHosts) { |
191 | rio_dprintk (RIO_DEBUG_TABLE, "RTA %s has unknown host unique number 0x%x\n", | 190 | rio_dprintk(RIO_DEBUG_TABLE, "RTA %s has unknown host unique number 0x%x\n", MapP->Name, MapP->HostUniqueNum); |
192 | MapP->Name, MapP->HostUniqueNum); | ||
193 | MapP->HostUniqueNum = 0; | 191 | MapP->HostUniqueNum = 0; |
194 | /* MapP->RtaUniqueNum = 0; */ | 192 | /* MapP->RtaUniqueNum = 0; */ |
195 | /* MapP->ID = 0; */ | 193 | /* MapP->ID = 0; */ |
196 | /* MapP->Flags = 0; */ | 194 | /* MapP->Flags = 0; */ |
197 | /* MapP->SysPort = 0; */ | 195 | /* MapP->SysPort = 0; */ |
198 | /* MapP->Name[0] = 0; */ | 196 | /* MapP->Name[0] = 0; */ |
199 | continue; | 197 | continue; |
200 | } | 198 | } |
201 | 199 | ||
202 | rio_dprintk (RIO_DEBUG_TABLE, "RIONewTable: entering(5)\n"); | 200 | rio_dprintk(RIO_DEBUG_TABLE, "RIONewTable: entering(5)\n"); |
203 | if ( MapP->RtaUniqueNum ) { /* (5) */ | 201 | if (MapP->RtaUniqueNum) { /* (5) */ |
204 | if ( !MapP->ID ) { | 202 | if (!MapP->ID) { |
205 | rio_dprintk (RIO_DEBUG_TABLE, "RIO: RTA %s has been allocated an ID of zero!\n", | 203 | rio_dprintk(RIO_DEBUG_TABLE, "RIO: RTA %s has been allocated an ID of zero!\n", MapP->Name); |
206 | MapP->Name); | 204 | p->RIOError.Error = ZERO_RTA_ID; |
207 | p->RIOError.Error = ZERO_RTA_ID; | ||
208 | p->RIOError.Entry = Entry; | 205 | p->RIOError.Entry = Entry; |
209 | return -ENXIO; | 206 | return -ENXIO; |
210 | } | 207 | } |
211 | if ( MapP->ID > MAX_RUP ) { | 208 | if (MapP->ID > MAX_RUP) { |
212 | rio_dprintk (RIO_DEBUG_TABLE, "RIO: RTA %s has been allocated an invalid ID %d\n", | 209 | rio_dprintk(RIO_DEBUG_TABLE, "RIO: RTA %s has been allocated an invalid ID %d\n", MapP->Name, MapP->ID); |
213 | MapP->Name, MapP->ID); | ||
214 | p->RIOError.Error = ID_NUMBER_OUT_OF_RANGE; | 210 | p->RIOError.Error = ID_NUMBER_OUT_OF_RANGE; |
215 | p->RIOError.Entry = Entry; | 211 | p->RIOError.Entry = Entry; |
216 | return -ENXIO; | 212 | return -ENXIO; |
217 | } | 213 | } |
218 | for ( SubEnt=0; SubEnt<Entry; SubEnt++ ) { | 214 | for (SubEnt = 0; SubEnt < Entry; SubEnt++) { |
219 | if ( MapP->HostUniqueNum == | 215 | if (MapP->HostUniqueNum == p->RIOConnectTable[SubEnt].HostUniqueNum && MapP->ID == p->RIOConnectTable[SubEnt].ID) { |
220 | p->RIOConnectTable[SubEnt].HostUniqueNum && | 216 | rio_dprintk(RIO_DEBUG_TABLE, "Dupl. ID number allocated to RTA %s and RTA %s\n", MapP->Name, p->RIOConnectTable[SubEnt].Name); |
221 | MapP->ID == p->RIOConnectTable[SubEnt].ID ) { | ||
222 | rio_dprintk (RIO_DEBUG_TABLE, "Dupl. ID number allocated to RTA %s and RTA %s\n", | ||
223 | MapP->Name, p->RIOConnectTable[SubEnt].Name); | ||
224 | p->RIOError.Error = DUPLICATED_RTA_ID; | 217 | p->RIOError.Error = DUPLICATED_RTA_ID; |
225 | p->RIOError.Entry = Entry; | 218 | p->RIOError.Entry = Entry; |
226 | p->RIOError.Other = SubEnt; | 219 | p->RIOError.Other = SubEnt; |
227 | return -ENXIO; | 220 | return -ENXIO; |
228 | } | 221 | } |
229 | /* | 222 | /* |
230 | ** If the RtaUniqueNum is the same, it may be looking at both | 223 | ** If the RtaUniqueNum is the same, it may be looking at both |
231 | ** entries for a 16 port RTA, so check the ids | 224 | ** entries for a 16 port RTA, so check the ids |
232 | */ | 225 | */ |
233 | if ((MapP->RtaUniqueNum == | 226 | if ((MapP->RtaUniqueNum == p->RIOConnectTable[SubEnt].RtaUniqueNum) |
234 | p->RIOConnectTable[SubEnt].RtaUniqueNum) | 227 | && (MapP->ID2 != p->RIOConnectTable[SubEnt].ID)) { |
235 | && (MapP->ID2 != p->RIOConnectTable[SubEnt].ID)) { | 228 | rio_dprintk(RIO_DEBUG_TABLE, "RTA %s has duplicate unique number\n", MapP->Name); |
236 | rio_dprintk (RIO_DEBUG_TABLE, "RTA %s has duplicate unique number\n",MapP->Name); | 229 | rio_dprintk(RIO_DEBUG_TABLE, "RTA %s has duplicate unique number\n", p->RIOConnectTable[SubEnt].Name); |
237 | rio_dprintk (RIO_DEBUG_TABLE, "RTA %s has duplicate unique number\n", | ||
238 | p->RIOConnectTable[SubEnt].Name); | ||
239 | p->RIOError.Error = DUPLICATE_UNIQUE_NUMBER; | 230 | p->RIOError.Error = DUPLICATE_UNIQUE_NUMBER; |
240 | p->RIOError.Entry = Entry; | 231 | p->RIOError.Entry = Entry; |
241 | p->RIOError.Other = SubEnt; | 232 | p->RIOError.Other = SubEnt; |
242 | return -ENXIO; | 233 | return -ENXIO; |
243 | } | 234 | } |
244 | } | 235 | } |
245 | rio_dprintk (RIO_DEBUG_TABLE, "RIONewTable: entering(7a)\n"); | 236 | rio_dprintk(RIO_DEBUG_TABLE, "RIONewTable: entering(7a)\n"); |
246 | /* (7a) */ | 237 | /* (7a) */ |
247 | if ((MapP->SysPort != NO_PORT)&&(MapP->SysPort % PORTS_PER_RTA)) { | 238 | if ((MapP->SysPort != NO_PORT) && (MapP->SysPort % PORTS_PER_RTA)) { |
248 | rio_dprintk (RIO_DEBUG_TABLE, "TTY Port number %d-RTA %s is not a multiple of %d!\n", | 239 | 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); |
249 | (int)MapP->SysPort,MapP->Name, PORTS_PER_RTA); | ||
250 | p->RIOError.Error = TTY_NUMBER_OUT_OF_RANGE; | 240 | p->RIOError.Error = TTY_NUMBER_OUT_OF_RANGE; |
251 | p->RIOError.Entry = Entry; | 241 | p->RIOError.Entry = Entry; |
252 | return -ENXIO; | 242 | return -ENXIO; |
253 | } | 243 | } |
254 | rio_dprintk (RIO_DEBUG_TABLE, "RIONewTable: entering(7b)\n"); | 244 | rio_dprintk(RIO_DEBUG_TABLE, "RIONewTable: entering(7b)\n"); |
255 | /* (7b) */ | 245 | /* (7b) */ |
256 | if ((MapP->SysPort != NO_PORT)&&(MapP->SysPort >= RIO_PORTS)) { | 246 | if ((MapP->SysPort != NO_PORT) && (MapP->SysPort >= RIO_PORTS)) { |
257 | rio_dprintk (RIO_DEBUG_TABLE, "TTY Port number %d for RTA %s is too big\n", | 247 | rio_dprintk(RIO_DEBUG_TABLE, "TTY Port number %d for RTA %s is too big\n", (int) MapP->SysPort, MapP->Name); |
258 | (int)MapP->SysPort, MapP->Name); | ||
259 | p->RIOError.Error = TTY_NUMBER_OUT_OF_RANGE; | 248 | p->RIOError.Error = TTY_NUMBER_OUT_OF_RANGE; |
260 | p->RIOError.Entry = Entry; | 249 | p->RIOError.Entry = Entry; |
261 | return -ENXIO; | 250 | return -ENXIO; |
262 | } | 251 | } |
263 | for ( SubEnt=0; SubEnt<Entry; SubEnt++ ) { | 252 | for (SubEnt = 0; SubEnt < Entry; SubEnt++) { |
264 | if ( p->RIOConnectTable[SubEnt].Flags & RTA16_SECOND_SLOT ) | 253 | if (p->RIOConnectTable[SubEnt].Flags & RTA16_SECOND_SLOT) |
265 | continue; | 254 | continue; |
266 | if ( p->RIOConnectTable[SubEnt].RtaUniqueNum ) { | 255 | if (p->RIOConnectTable[SubEnt].RtaUniqueNum) { |
267 | rio_dprintk (RIO_DEBUG_TABLE, "RIONewTable: entering(8)\n"); | 256 | rio_dprintk(RIO_DEBUG_TABLE, "RIONewTable: entering(8)\n"); |
268 | /* (8) */ | 257 | /* (8) */ |
269 | if ( (MapP->SysPort != NO_PORT) && (MapP->SysPort == | 258 | if ((MapP->SysPort != NO_PORT) && (MapP->SysPort == p->RIOConnectTable[SubEnt].SysPort)) { |
270 | p->RIOConnectTable[SubEnt].SysPort) ) { | 259 | rio_dprintk(RIO_DEBUG_TABLE, "RTA %s:same TTY port # as RTA %s (%d)\n", MapP->Name, p->RIOConnectTable[SubEnt].Name, (int) MapP->SysPort); |
271 | rio_dprintk (RIO_DEBUG_TABLE, "RTA %s:same TTY port # as RTA %s (%d)\n", | ||
272 | MapP->Name, p->RIOConnectTable[SubEnt].Name, | ||
273 | (int)MapP->SysPort); | ||
274 | p->RIOError.Error = TTY_NUMBER_IN_USE; | 260 | p->RIOError.Error = TTY_NUMBER_IN_USE; |
275 | p->RIOError.Entry = Entry; | 261 | p->RIOError.Entry = Entry; |
276 | p->RIOError.Other = SubEnt; | 262 | p->RIOError.Other = SubEnt; |
277 | return -ENXIO; | 263 | return -ENXIO; |
278 | } | 264 | } |
279 | rio_dprintk (RIO_DEBUG_TABLE, "RIONewTable: entering(9)\n"); | 265 | rio_dprintk(RIO_DEBUG_TABLE, "RIONewTable: entering(9)\n"); |
280 | if (strcmp(MapP->Name, | 266 | if (strcmp(MapP->Name, p->RIOConnectTable[SubEnt].Name) == 0 && !(MapP->Flags & RTA16_SECOND_SLOT)) { /* (9) */ |
281 | p->RIOConnectTable[SubEnt].Name)==0 && !(MapP->Flags & RTA16_SECOND_SLOT)) { /* (9) */ | 267 | rio_dprintk(RIO_DEBUG_TABLE, "RTA name %s used twice\n", MapP->Name); |
282 | rio_dprintk (RIO_DEBUG_TABLE, "RTA name %s used twice\n", MapP->Name); | ||
283 | p->RIOError.Error = NAME_USED_TWICE; | 268 | p->RIOError.Error = NAME_USED_TWICE; |
284 | p->RIOError.Entry = Entry; | 269 | p->RIOError.Entry = Entry; |
285 | p->RIOError.Other = SubEnt; | 270 | p->RIOError.Other = SubEnt; |
@@ -287,19 +272,16 @@ struct rio_info * p; | |||
287 | } | 272 | } |
288 | } | 273 | } |
289 | } | 274 | } |
290 | } | 275 | } else { /* (6) */ |
291 | else { /* (6) */ | 276 | rio_dprintk(RIO_DEBUG_TABLE, "RIONewTable: entering(6)\n"); |
292 | rio_dprintk (RIO_DEBUG_TABLE, "RIONewTable: entering(6)\n"); | 277 | if (MapP->ID) { |
293 | if ( MapP->ID ) { | 278 | rio_dprintk(RIO_DEBUG_TABLE, "RIO:HOST %s has been allocated ID that isn't zero!\n", MapP->Name); |
294 | rio_dprintk (RIO_DEBUG_TABLE, "RIO:HOST %s has been allocated ID that isn't zero!\n", | ||
295 | MapP->Name); | ||
296 | p->RIOError.Error = HOST_ID_NOT_ZERO; | 279 | p->RIOError.Error = HOST_ID_NOT_ZERO; |
297 | p->RIOError.Entry = Entry; | 280 | p->RIOError.Entry = Entry; |
298 | return -ENXIO; | 281 | return -ENXIO; |
299 | } | 282 | } |
300 | if ( MapP->SysPort != NO_PORT ) { | 283 | if (MapP->SysPort != NO_PORT) { |
301 | rio_dprintk (RIO_DEBUG_TABLE, "RIO: HOST %s has been allocated port numbers!\n", | 284 | rio_dprintk(RIO_DEBUG_TABLE, "RIO: HOST %s has been allocated port numbers!\n", MapP->Name); |
302 | MapP->Name); | ||
303 | p->RIOError.Error = HOST_SYSPORT_BAD; | 285 | p->RIOError.Error = HOST_SYSPORT_BAD; |
304 | p->RIOError.Entry = Entry; | 286 | p->RIOError.Entry = Entry; |
305 | return -ENXIO; | 287 | return -ENXIO; |
@@ -308,106 +290,101 @@ struct rio_info * p; | |||
308 | } | 290 | } |
309 | 291 | ||
310 | /* | 292 | /* |
311 | ** wow! if we get here then it's a goody! | 293 | ** wow! if we get here then it's a goody! |
312 | */ | 294 | */ |
313 | 295 | ||
314 | /* | 296 | /* |
315 | ** Zero the (old) entries for each host... | 297 | ** Zero the (old) entries for each host... |
316 | */ | 298 | */ |
317 | for ( Host=0; Host<RIO_HOSTS; Host++ ) { | 299 | for (Host = 0; Host < RIO_HOSTS; Host++) { |
318 | for ( Entry=0; Entry<MAX_RUP; Entry++ ) { | 300 | for (Entry = 0; Entry < MAX_RUP; Entry++) { |
319 | bzero((caddr_t)&p->RIOHosts[Host].Mapping[Entry], | 301 | bzero((caddr_t) & p->RIOHosts[Host].Mapping[Entry], sizeof(struct Map)); |
320 | sizeof(struct Map)); | ||
321 | } | 302 | } |
322 | bzero((caddr_t)&p->RIOHosts[Host].Name[0], | 303 | bzero((caddr_t) & p->RIOHosts[Host].Name[0], sizeof(p->RIOHosts[Host].Name)); |
323 | sizeof(p->RIOHosts[Host].Name) ); | ||
324 | } | 304 | } |
325 | 305 | ||
326 | /* | 306 | /* |
327 | ** Copy in the new table entries | 307 | ** Copy in the new table entries |
328 | */ | 308 | */ |
329 | for ( Entry=0; Entry< TOTAL_MAP_ENTRIES; Entry++ ) { | 309 | for (Entry = 0; Entry < TOTAL_MAP_ENTRIES; Entry++) { |
330 | rio_dprintk (RIO_DEBUG_TABLE, "RIONewTable: Copy table for Host entry %d\n", Entry); | 310 | rio_dprintk(RIO_DEBUG_TABLE, "RIONewTable: Copy table for Host entry %d\n", Entry); |
331 | MapP = &p->RIOConnectTable[Entry]; | 311 | MapP = &p->RIOConnectTable[Entry]; |
332 | 312 | ||
333 | /* | 313 | /* |
334 | ** Now, if it is an empty slot ignore it! | 314 | ** Now, if it is an empty slot ignore it! |
335 | */ | 315 | */ |
336 | if ( MapP->HostUniqueNum==0 ) | 316 | if (MapP->HostUniqueNum == 0) |
337 | continue; | 317 | continue; |
338 | 318 | ||
339 | /* | 319 | /* |
340 | ** we saved the host number earlier, so grab it back | 320 | ** we saved the host number earlier, so grab it back |
341 | */ | 321 | */ |
342 | HostP = &p->RIOHosts[MapP->Topology[0].Unit]; | 322 | HostP = &p->RIOHosts[MapP->Topology[0].Unit]; |
343 | 323 | ||
344 | /* | 324 | /* |
345 | ** If it is a host, then we only need to fill in the name field. | 325 | ** If it is a host, then we only need to fill in the name field. |
346 | */ | 326 | */ |
347 | if ( MapP->ID==0 ) { | 327 | if (MapP->ID == 0) { |
348 | rio_dprintk (RIO_DEBUG_TABLE, "Host entry found. Name %s\n", MapP->Name); | 328 | rio_dprintk(RIO_DEBUG_TABLE, "Host entry found. Name %s\n", MapP->Name); |
349 | bcopy(MapP->Name,HostP->Name,MAX_NAME_LEN); | 329 | bcopy(MapP->Name, HostP->Name, MAX_NAME_LEN); |
350 | continue; | 330 | continue; |
351 | } | 331 | } |
352 | 332 | ||
353 | /* | 333 | /* |
354 | ** Its an RTA entry, so fill in the host mapping entries for it | 334 | ** Its an RTA entry, so fill in the host mapping entries for it |
355 | ** and the port mapping entries. Notice that entry zero is for | 335 | ** and the port mapping entries. Notice that entry zero is for |
356 | ** ID one. | 336 | ** ID one. |
357 | */ | 337 | */ |
358 | HostMapP = &HostP->Mapping[MapP->ID-1]; | 338 | HostMapP = &HostP->Mapping[MapP->ID - 1]; |
359 | 339 | ||
360 | if (MapP->Flags & SLOT_IN_USE) { | 340 | if (MapP->Flags & SLOT_IN_USE) { |
361 | rio_dprintk (RIO_DEBUG_TABLE, "Rta entry found. Name %s\n", MapP->Name); | 341 | rio_dprintk(RIO_DEBUG_TABLE, "Rta entry found. Name %s\n", MapP->Name); |
362 | /* | 342 | /* |
363 | ** structure assign, then sort out the bits we shouldn't have done | 343 | ** structure assign, then sort out the bits we shouldn't have done |
364 | */ | 344 | */ |
365 | *HostMapP = *MapP; | 345 | *HostMapP = *MapP; |
366 | 346 | ||
367 | HostMapP->Flags = SLOT_IN_USE; | 347 | HostMapP->Flags = SLOT_IN_USE; |
368 | if (MapP->Flags & RTA16_SECOND_SLOT) | 348 | if (MapP->Flags & RTA16_SECOND_SLOT) |
369 | HostMapP->Flags |= RTA16_SECOND_SLOT; | 349 | HostMapP->Flags |= RTA16_SECOND_SLOT; |
370 | 350 | ||
371 | RIOReMapPorts(p, HostP, HostMapP ); | 351 | RIOReMapPorts(p, HostP, HostMapP); |
372 | } | 352 | } else { |
373 | else { | 353 | rio_dprintk(RIO_DEBUG_TABLE, "TENTATIVE Rta entry found. Name %s\n", MapP->Name); |
374 | rio_dprintk (RIO_DEBUG_TABLE, "TENTATIVE Rta entry found. Name %s\n", MapP->Name); | ||
375 | } | 354 | } |
376 | } | 355 | } |
377 | 356 | ||
378 | for ( Entry=0; Entry< TOTAL_MAP_ENTRIES; Entry++ ) { | 357 | for (Entry = 0; Entry < TOTAL_MAP_ENTRIES; Entry++) { |
379 | p->RIOSavedTable[Entry] = p->RIOConnectTable[Entry]; | 358 | p->RIOSavedTable[Entry] = p->RIOConnectTable[Entry]; |
380 | } | 359 | } |
381 | 360 | ||
382 | for ( Host=0; Host<p->RIONumHosts; Host++ ) { | 361 | for (Host = 0; Host < p->RIONumHosts; Host++) { |
383 | for ( SubEnt=0; SubEnt<LINKS_PER_UNIT; SubEnt++ ) { | 362 | for (SubEnt = 0; SubEnt < LINKS_PER_UNIT; SubEnt++) { |
384 | p->RIOHosts[Host].Topology[SubEnt].Unit = ROUTE_DISCONNECT; | 363 | p->RIOHosts[Host].Topology[SubEnt].Unit = ROUTE_DISCONNECT; |
385 | p->RIOHosts[Host].Topology[SubEnt].Link = NO_LINK; | 364 | p->RIOHosts[Host].Topology[SubEnt].Link = NO_LINK; |
386 | } | 365 | } |
387 | for ( Entry=0; Entry<MAX_RUP; Entry++ ) { | 366 | for (Entry = 0; Entry < MAX_RUP; Entry++) { |
388 | for ( SubEnt=0; SubEnt<LINKS_PER_UNIT; SubEnt++ ) { | 367 | for (SubEnt = 0; SubEnt < LINKS_PER_UNIT; SubEnt++) { |
389 | p->RIOHosts[Host].Mapping[Entry].Topology[SubEnt].Unit = | 368 | p->RIOHosts[Host].Mapping[Entry].Topology[SubEnt].Unit = ROUTE_DISCONNECT; |
390 | ROUTE_DISCONNECT; | 369 | p->RIOHosts[Host].Mapping[Entry].Topology[SubEnt].Link = NO_LINK; |
391 | p->RIOHosts[Host].Mapping[Entry].Topology[SubEnt].Link = | ||
392 | NO_LINK; | ||
393 | } | 370 | } |
394 | } | 371 | } |
395 | if ( !p->RIOHosts[Host].Name[0] ) { | 372 | if (!p->RIOHosts[Host].Name[0]) { |
396 | bcopy("HOST 1",p->RIOHosts[Host].Name,7); | 373 | bcopy("HOST 1", p->RIOHosts[Host].Name, 7); |
397 | p->RIOHosts[Host].Name[5] += Host; | 374 | p->RIOHosts[Host].Name[5] += Host; |
398 | } | 375 | } |
399 | /* | 376 | /* |
400 | ** Check that default name assigned is unique. | 377 | ** Check that default name assigned is unique. |
401 | */ | 378 | */ |
402 | Host1 = Host; | 379 | Host1 = Host; |
403 | NameIsUnique = 0; | 380 | NameIsUnique = 0; |
404 | while (!NameIsUnique) { | 381 | while (!NameIsUnique) { |
405 | NameIsUnique = 1; | 382 | NameIsUnique = 1; |
406 | for ( Host2=0; Host2<p->RIONumHosts; Host2++ ) { | 383 | for (Host2 = 0; Host2 < p->RIONumHosts; Host2++) { |
407 | if (Host2 == Host) | 384 | if (Host2 == Host) |
408 | continue; | 385 | continue; |
409 | if (strcmp(p->RIOHosts[Host].Name, p->RIOHosts[Host2].Name) | 386 | if (strcmp(p->RIOHosts[Host].Name, p->RIOHosts[Host2].Name) |
410 | == 0) { | 387 | == 0) { |
411 | NameIsUnique = 0; | 388 | NameIsUnique = 0; |
412 | Host1++; | 389 | Host1++; |
413 | if (Host1 >= p->RIONumHosts) | 390 | if (Host1 >= p->RIONumHosts) |
@@ -417,15 +394,14 @@ struct rio_info * p; | |||
417 | } | 394 | } |
418 | } | 395 | } |
419 | /* | 396 | /* |
420 | ** Rename host if name already used. | 397 | ** Rename host if name already used. |
421 | */ | 398 | */ |
422 | if (Host1 != Host) | 399 | if (Host1 != Host) { |
423 | { | 400 | rio_dprintk(RIO_DEBUG_TABLE, "Default name %s already used\n", p->RIOHosts[Host].Name); |
424 | rio_dprintk (RIO_DEBUG_TABLE, "Default name %s already used\n", p->RIOHosts[Host].Name); | 401 | bcopy("HOST 1", p->RIOHosts[Host].Name, 7); |
425 | bcopy("HOST 1",p->RIOHosts[Host].Name,7); | ||
426 | p->RIOHosts[Host].Name[5] += Host1; | 402 | p->RIOHosts[Host].Name[5] += Host1; |
427 | } | 403 | } |
428 | rio_dprintk (RIO_DEBUG_TABLE, "Assigning default name %s\n", p->RIOHosts[Host].Name); | 404 | rio_dprintk(RIO_DEBUG_TABLE, "Assigning default name %s\n", p->RIOHosts[Host].Name); |
429 | } | 405 | } |
430 | return 0; | 406 | return 0; |
431 | } | 407 | } |
@@ -434,9 +410,8 @@ struct rio_info * p; | |||
434 | ** User process needs the config table - build it from first | 410 | ** User process needs the config table - build it from first |
435 | ** principles. | 411 | ** principles. |
436 | */ | 412 | */ |
437 | int | 413 | int RIOApel(p) |
438 | RIOApel(p) | 414 | struct rio_info *p; |
439 | struct rio_info * p; | ||
440 | { | 415 | { |
441 | int Host; | 416 | int Host; |
442 | int link; | 417 | int link; |
@@ -446,35 +421,34 @@ struct rio_info * p; | |||
446 | struct Host *HostP; | 421 | struct Host *HostP; |
447 | long oldspl; | 422 | long oldspl; |
448 | 423 | ||
449 | disable(oldspl); /* strange but true! */ | 424 | disable(oldspl); /* strange but true! */ |
450 | 425 | ||
451 | rio_dprintk (RIO_DEBUG_TABLE, "Generating a table to return to config.rio\n"); | 426 | rio_dprintk(RIO_DEBUG_TABLE, "Generating a table to return to config.rio\n"); |
452 | 427 | ||
453 | bzero((caddr_t)&p->RIOConnectTable[0], | 428 | bzero((caddr_t) & p->RIOConnectTable[0], sizeof(struct Map) * TOTAL_MAP_ENTRIES); |
454 | sizeof(struct Map) * TOTAL_MAP_ENTRIES ); | ||
455 | 429 | ||
456 | for ( Host=0; Host<RIO_HOSTS; Host++ ) { | 430 | for (Host = 0; Host < RIO_HOSTS; Host++) { |
457 | rio_dprintk (RIO_DEBUG_TABLE, "Processing host %d\n", Host); | 431 | rio_dprintk(RIO_DEBUG_TABLE, "Processing host %d\n", Host); |
458 | HostP = &p->RIOHosts[Host]; | 432 | HostP = &p->RIOHosts[Host]; |
459 | MapP = &p->RIOConnectTable[Next++]; | 433 | MapP = &p->RIOConnectTable[Next++]; |
460 | MapP->HostUniqueNum = HostP->UniqueNum; | 434 | MapP->HostUniqueNum = HostP->UniqueNum; |
461 | if ( (HostP->Flags & RUN_STATE) != RC_RUNNING ) | 435 | if ((HostP->Flags & RUN_STATE) != RC_RUNNING) |
462 | continue; | 436 | continue; |
463 | MapP->RtaUniqueNum = 0; | 437 | MapP->RtaUniqueNum = 0; |
464 | MapP->ID = 0; | 438 | MapP->ID = 0; |
465 | MapP->Flags = SLOT_IN_USE; | 439 | MapP->Flags = SLOT_IN_USE; |
466 | MapP->SysPort = NO_PORT; | 440 | MapP->SysPort = NO_PORT; |
467 | for ( link=0; link<LINKS_PER_UNIT; link++ ) | 441 | for (link = 0; link < LINKS_PER_UNIT; link++) |
468 | MapP->Topology[link] = HostP->Topology[link]; | 442 | MapP->Topology[link] = HostP->Topology[link]; |
469 | bcopy(HostP->Name,MapP->Name,MAX_NAME_LEN); | 443 | bcopy(HostP->Name, MapP->Name, MAX_NAME_LEN); |
470 | for ( Rup=0; Rup<MAX_RUP; Rup++ ) { | 444 | for (Rup = 0; Rup < MAX_RUP; Rup++) { |
471 | if ( HostP->Mapping[Rup].Flags & (SLOT_IN_USE|SLOT_TENTATIVE) ) { | 445 | if (HostP->Mapping[Rup].Flags & (SLOT_IN_USE | SLOT_TENTATIVE)) { |
472 | p->RIOConnectTable[Next] = HostP->Mapping[Rup]; | 446 | p->RIOConnectTable[Next] = HostP->Mapping[Rup]; |
473 | if ( HostP->Mapping[Rup].Flags & SLOT_IN_USE) | 447 | if (HostP->Mapping[Rup].Flags & SLOT_IN_USE) |
474 | p->RIOConnectTable[Next].Flags |= SLOT_IN_USE; | 448 | p->RIOConnectTable[Next].Flags |= SLOT_IN_USE; |
475 | if ( HostP->Mapping[Rup].Flags & SLOT_TENTATIVE) | 449 | if (HostP->Mapping[Rup].Flags & SLOT_TENTATIVE) |
476 | p->RIOConnectTable[Next].Flags |= SLOT_TENTATIVE; | 450 | p->RIOConnectTable[Next].Flags |= SLOT_TENTATIVE; |
477 | if ( HostP->Mapping[Rup].Flags & RTA16_SECOND_SLOT ) | 451 | if (HostP->Mapping[Rup].Flags & RTA16_SECOND_SLOT) |
478 | p->RIOConnectTable[Next].Flags |= RTA16_SECOND_SLOT; | 452 | p->RIOConnectTable[Next].Flags |= RTA16_SECOND_SLOT; |
479 | Next++; | 453 | Next++; |
480 | } | 454 | } |
@@ -489,8 +463,7 @@ struct rio_info * p; | |||
489 | ** if the entry is suitably inactive, then we can gob on it and remove | 463 | ** if the entry is suitably inactive, then we can gob on it and remove |
490 | ** it from the table. | 464 | ** it from the table. |
491 | */ | 465 | */ |
492 | int | 466 | int RIODeleteRta(p, MapP) |
493 | RIODeleteRta(p, MapP) | ||
494 | struct rio_info *p; | 467 | struct rio_info *p; |
495 | struct Map *MapP; | 468 | struct Map *MapP; |
496 | { | 469 | { |
@@ -502,110 +475,98 @@ struct Map *MapP; | |||
502 | int work_done = 0; | 475 | int work_done = 0; |
503 | unsigned long lock_flags, sem_flags; | 476 | unsigned long lock_flags, sem_flags; |
504 | 477 | ||
505 | rio_dprintk (RIO_DEBUG_TABLE, "Delete entry on host %x, rta %x\n", | 478 | rio_dprintk(RIO_DEBUG_TABLE, "Delete entry on host %x, rta %x\n", MapP->HostUniqueNum, MapP->RtaUniqueNum); |
506 | MapP->HostUniqueNum, MapP->RtaUniqueNum); | ||
507 | 479 | ||
508 | for ( host=0; host < p->RIONumHosts; host++ ) { | 480 | for (host = 0; host < p->RIONumHosts; host++) { |
509 | HostP = &p->RIOHosts[host]; | 481 | HostP = &p->RIOHosts[host]; |
510 | 482 | ||
511 | rio_spin_lock_irqsave( &HostP->HostLock, lock_flags ); | 483 | rio_spin_lock_irqsave(&HostP->HostLock, lock_flags); |
512 | 484 | ||
513 | if ( (HostP->Flags & RUN_STATE) != RC_RUNNING ) { | 485 | if ((HostP->Flags & RUN_STATE) != RC_RUNNING) { |
514 | rio_spin_unlock_irqrestore(&HostP->HostLock, lock_flags); | 486 | rio_spin_unlock_irqrestore(&HostP->HostLock, lock_flags); |
515 | continue; | 487 | continue; |
516 | } | 488 | } |
517 | 489 | ||
518 | for ( entry=0; entry<MAX_RUP; entry++ ) { | 490 | for (entry = 0; entry < MAX_RUP; entry++) { |
519 | if ( MapP->RtaUniqueNum == HostP->Mapping[entry].RtaUniqueNum ) { | 491 | if (MapP->RtaUniqueNum == HostP->Mapping[entry].RtaUniqueNum) { |
520 | HostMapP = &HostP->Mapping[entry]; | 492 | HostMapP = &HostP->Mapping[entry]; |
521 | rio_dprintk (RIO_DEBUG_TABLE, "Found entry offset %d on host %s\n", | 493 | rio_dprintk(RIO_DEBUG_TABLE, "Found entry offset %d on host %s\n", entry, HostP->Name); |
522 | entry, HostP->Name); | ||
523 | 494 | ||
524 | /* | 495 | /* |
525 | ** Check all four links of the unit are disconnected | 496 | ** Check all four links of the unit are disconnected |
526 | */ | 497 | */ |
527 | for ( link=0; link< LINKS_PER_UNIT; link++ ) { | 498 | for (link = 0; link < LINKS_PER_UNIT; link++) { |
528 | if ( HostMapP->Topology[link].Unit != ROUTE_DISCONNECT ) { | 499 | if (HostMapP->Topology[link].Unit != ROUTE_DISCONNECT) { |
529 | rio_dprintk (RIO_DEBUG_TABLE, "Entry is in use and cannot be deleted!\n"); | 500 | rio_dprintk(RIO_DEBUG_TABLE, "Entry is in use and cannot be deleted!\n"); |
530 | p->RIOError.Error = UNIT_IS_IN_USE; | 501 | p->RIOError.Error = UNIT_IS_IN_USE; |
531 | rio_spin_unlock_irqrestore( &HostP->HostLock, lock_flags); | 502 | rio_spin_unlock_irqrestore(&HostP->HostLock, lock_flags); |
532 | return -EBUSY; | 503 | return -EBUSY; |
533 | } | 504 | } |
534 | } | 505 | } |
535 | /* | 506 | /* |
536 | ** Slot has been allocated, BUT not booted/routed/ | 507 | ** Slot has been allocated, BUT not booted/routed/ |
537 | ** connected/selected or anything else-ed | 508 | ** connected/selected or anything else-ed |
538 | */ | 509 | */ |
539 | SysPort = HostMapP->SysPort; | 510 | SysPort = HostMapP->SysPort; |
540 | 511 | ||
541 | if ( SysPort != NO_PORT ) { | 512 | if (SysPort != NO_PORT) { |
542 | for (port=SysPort; port < SysPort+PORTS_PER_RTA; port++) { | 513 | for (port = SysPort; port < SysPort + PORTS_PER_RTA; port++) { |
543 | PortP = p->RIOPortp[port]; | 514 | PortP = p->RIOPortp[port]; |
544 | rio_dprintk (RIO_DEBUG_TABLE, "Unmap port\n"); | 515 | rio_dprintk(RIO_DEBUG_TABLE, "Unmap port\n"); |
545 | 516 | ||
546 | rio_spin_lock_irqsave( &PortP->portSem, sem_flags ); | 517 | rio_spin_lock_irqsave(&PortP->portSem, sem_flags); |
547 | 518 | ||
548 | PortP->Mapped = 0; | 519 | PortP->Mapped = 0; |
549 | 520 | ||
550 | if ( PortP->State & (RIO_MOPEN|RIO_LOPEN) ) { | 521 | if (PortP->State & (RIO_MOPEN | RIO_LOPEN)) { |
551 | 522 | ||
552 | rio_dprintk (RIO_DEBUG_TABLE, "Gob on port\n"); | 523 | rio_dprintk(RIO_DEBUG_TABLE, "Gob on port\n"); |
553 | PortP->TxBufferIn = PortP->TxBufferOut = 0; | 524 | PortP->TxBufferIn = PortP->TxBufferOut = 0; |
554 | /* What should I do | 525 | /* What should I do |
555 | wakeup( &PortP->TxBufferIn ); | 526 | wakeup( &PortP->TxBufferIn ); |
556 | wakeup( &PortP->TxBufferOut); | 527 | wakeup( &PortP->TxBufferOut); |
557 | */ | 528 | */ |
558 | PortP->InUse = NOT_INUSE; | 529 | PortP->InUse = NOT_INUSE; |
559 | /* What should I do | 530 | /* What should I do |
560 | wakeup( &PortP->InUse ); | 531 | wakeup( &PortP->InUse ); |
561 | signal(PortP->TtyP->t_pgrp,SIGKILL); | 532 | signal(PortP->TtyP->t_pgrp,SIGKILL); |
562 | ttyflush(PortP->TtyP,(FREAD|FWRITE)); | 533 | ttyflush(PortP->TtyP,(FREAD|FWRITE)); |
563 | */ | 534 | */ |
564 | PortP->State |= RIO_CLOSING | RIO_DELETED; | 535 | PortP->State |= RIO_CLOSING | RIO_DELETED; |
565 | } | 536 | } |
566 | 537 | ||
567 | /* | 538 | /* |
568 | ** For the second slot of a 16 port RTA, the | 539 | ** For the second slot of a 16 port RTA, the |
569 | ** driver needs to reset the changes made to | 540 | ** driver needs to reset the changes made to |
570 | ** the phb to port mappings in RIORouteRup. | 541 | ** the phb to port mappings in RIORouteRup. |
571 | */ | 542 | */ |
572 | if (PortP->SecondBlock) { | 543 | if (PortP->SecondBlock) { |
573 | ushort dest_unit = HostMapP->ID; | 544 | ushort dest_unit = HostMapP->ID; |
574 | ushort dest_port = port - SysPort; | 545 | ushort dest_port = port - SysPort; |
575 | WORD *TxPktP; | 546 | WORD *TxPktP; |
576 | PKT *Pkt; | 547 | PKT *Pkt; |
577 | 548 | ||
578 | for (TxPktP = PortP->TxStart; | 549 | for (TxPktP = PortP->TxStart; TxPktP <= PortP->TxEnd; TxPktP++) { |
579 | TxPktP <= PortP->TxEnd; TxPktP++) { | ||
580 | /* | 550 | /* |
581 | ** *TxPktP is the pointer to the | 551 | ** *TxPktP is the pointer to the |
582 | ** transmit packet on the host card. | 552 | ** transmit packet on the host card. |
583 | ** This needs to be translated into | 553 | ** This needs to be translated into |
584 | ** a 32 bit pointer so it can be | 554 | ** a 32 bit pointer so it can be |
585 | ** accessed from the driver. | 555 | ** accessed from the driver. |
586 | */ | 556 | */ |
587 | Pkt = (PKT *) RIO_PTR(HostP->Caddr, | 557 | Pkt = (PKT *) RIO_PTR(HostP->Caddr, RWORD(*TxPktP)); |
588 | RWORD(*TxPktP)); | 558 | rio_dprintk(RIO_DEBUG_TABLE, "Tx packet (%x) destination: Old %x:%x New %x:%x\n", *TxPktP, Pkt->dest_unit, Pkt->dest_port, dest_unit, dest_port); |
589 | rio_dprintk (RIO_DEBUG_TABLE, | ||
590 | "Tx packet (%x) destination: Old %x:%x New %x:%x\n", | ||
591 | *TxPktP, Pkt->dest_unit, | ||
592 | Pkt->dest_port, dest_unit, dest_port); | ||
593 | WWORD(Pkt->dest_unit, dest_unit); | 559 | WWORD(Pkt->dest_unit, dest_unit); |
594 | WWORD(Pkt->dest_port, dest_port); | 560 | WWORD(Pkt->dest_port, dest_port); |
595 | } | 561 | } |
596 | rio_dprintk (RIO_DEBUG_TABLE, | 562 | rio_dprintk(RIO_DEBUG_TABLE, "Port %d phb destination: Old %x:%x New %x:%x\n", port, PortP->PhbP->destination & 0xff, (PortP->PhbP->destination >> 8) & 0xff, dest_unit, dest_port); |
597 | "Port %d phb destination: Old %x:%x New %x:%x\n", | 563 | WWORD(PortP->PhbP->destination, dest_unit + (dest_port << 8)); |
598 | port, PortP->PhbP->destination & 0xff, | ||
599 | (PortP->PhbP->destination >> 8) & 0xff, | ||
600 | dest_unit, dest_port); | ||
601 | WWORD(PortP->PhbP->destination, | ||
602 | dest_unit + (dest_port << 8)); | ||
603 | } | 564 | } |
604 | rio_spin_unlock_irqrestore(&PortP->portSem, sem_flags); | 565 | rio_spin_unlock_irqrestore(&PortP->portSem, sem_flags); |
605 | } | 566 | } |
606 | } | 567 | } |
607 | rio_dprintk (RIO_DEBUG_TABLE, "Entry nulled.\n"); | 568 | rio_dprintk(RIO_DEBUG_TABLE, "Entry nulled.\n"); |
608 | bzero((char *)HostMapP,sizeof(struct Map)); | 569 | bzero((char *) HostMapP, sizeof(struct Map)); |
609 | work_done++; | 570 | work_done++; |
610 | } | 571 | } |
611 | } | 572 | } |
@@ -613,203 +574,178 @@ struct Map *MapP; | |||
613 | } | 574 | } |
614 | 575 | ||
615 | /* XXXXX lock me up */ | 576 | /* XXXXX lock me up */ |
616 | for ( entry=0; entry< TOTAL_MAP_ENTRIES; entry++ ) { | 577 | for (entry = 0; entry < TOTAL_MAP_ENTRIES; entry++) { |
617 | if ( p->RIOSavedTable[entry].RtaUniqueNum == MapP->RtaUniqueNum ) { | 578 | if (p->RIOSavedTable[entry].RtaUniqueNum == MapP->RtaUniqueNum) { |
618 | bzero((char *)&p->RIOSavedTable[entry],sizeof(struct Map)); | 579 | bzero((char *) &p->RIOSavedTable[entry], sizeof(struct Map)); |
619 | work_done++; | 580 | work_done++; |
620 | } | 581 | } |
621 | if ( p->RIOConnectTable[entry].RtaUniqueNum == MapP->RtaUniqueNum ) { | 582 | if (p->RIOConnectTable[entry].RtaUniqueNum == MapP->RtaUniqueNum) { |
622 | bzero((char *)&p->RIOConnectTable[entry],sizeof(struct Map)); | 583 | bzero((char *) &p->RIOConnectTable[entry], sizeof(struct Map)); |
623 | work_done++; | 584 | work_done++; |
624 | } | 585 | } |
625 | } | 586 | } |
626 | if ( work_done ) | 587 | if (work_done) |
627 | return 0; | 588 | return 0; |
628 | 589 | ||
629 | rio_dprintk (RIO_DEBUG_TABLE, "Couldn't find entry to be deleted\n"); | 590 | rio_dprintk(RIO_DEBUG_TABLE, "Couldn't find entry to be deleted\n"); |
630 | p->RIOError.Error = COULDNT_FIND_ENTRY; | 591 | p->RIOError.Error = COULDNT_FIND_ENTRY; |
631 | return -ENXIO; | 592 | return -ENXIO; |
632 | } | 593 | } |
633 | 594 | ||
634 | int RIOAssignRta( struct rio_info *p, struct Map *MapP ) | 595 | int RIOAssignRta(struct rio_info *p, struct Map *MapP) |
635 | { | 596 | { |
636 | int host; | 597 | int host; |
637 | struct Map *HostMapP; | 598 | struct Map *HostMapP; |
638 | char *sptr; | 599 | char *sptr; |
639 | int link; | 600 | int link; |
640 | 601 | ||
641 | 602 | ||
642 | rio_dprintk (RIO_DEBUG_TABLE, "Assign entry on host %x, rta %x, ID %d, Sysport %d\n", | 603 | 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); |
643 | MapP->HostUniqueNum,MapP->RtaUniqueNum, | 604 | |
644 | MapP->ID, (int)MapP->SysPort); | 605 | if ((MapP->ID != (ushort) - 1) && ((int) MapP->ID < (int) 1 || (int) MapP->ID > MAX_RUP)) { |
645 | 606 | rio_dprintk(RIO_DEBUG_TABLE, "Bad ID in map entry!\n"); | |
646 | if ((MapP->ID != (ushort)-1) && | 607 | p->RIOError.Error = ID_NUMBER_OUT_OF_RANGE; |
647 | ((int)MapP->ID < (int)1 || (int)MapP->ID > MAX_RUP )) | 608 | return -EINVAL; |
648 | { | 609 | } |
649 | rio_dprintk (RIO_DEBUG_TABLE, "Bad ID in map entry!\n"); | 610 | if (MapP->RtaUniqueNum == 0) { |
650 | p->RIOError.Error = ID_NUMBER_OUT_OF_RANGE; | 611 | rio_dprintk(RIO_DEBUG_TABLE, "Rta Unique number zero!\n"); |
651 | return -EINVAL; | 612 | p->RIOError.Error = RTA_UNIQUE_NUMBER_ZERO; |
652 | } | 613 | return -EINVAL; |
653 | if (MapP->RtaUniqueNum == 0) | 614 | } |
654 | { | 615 | if ((MapP->SysPort != NO_PORT) && (MapP->SysPort % PORTS_PER_RTA)) { |
655 | rio_dprintk (RIO_DEBUG_TABLE, "Rta Unique number zero!\n"); | 616 | rio_dprintk(RIO_DEBUG_TABLE, "Port %d not multiple of %d!\n", (int) MapP->SysPort, PORTS_PER_RTA); |
656 | p->RIOError.Error = RTA_UNIQUE_NUMBER_ZERO; | 617 | p->RIOError.Error = TTY_NUMBER_OUT_OF_RANGE; |
657 | return -EINVAL; | 618 | return -EINVAL; |
658 | } | 619 | } |
659 | if ( (MapP->SysPort != NO_PORT) && (MapP->SysPort % PORTS_PER_RTA) ) | 620 | if ((MapP->SysPort != NO_PORT) && (MapP->SysPort >= RIO_PORTS)) { |
660 | { | 621 | rio_dprintk(RIO_DEBUG_TABLE, "Port %d not valid!\n", (int) MapP->SysPort); |
661 | rio_dprintk (RIO_DEBUG_TABLE, "Port %d not multiple of %d!\n",(int)MapP->SysPort,PORTS_PER_RTA); | 622 | p->RIOError.Error = TTY_NUMBER_OUT_OF_RANGE; |
662 | p->RIOError.Error = TTY_NUMBER_OUT_OF_RANGE; | 623 | return -EINVAL; |
663 | return -EINVAL; | 624 | } |
664 | } | 625 | |
665 | if ( (MapP->SysPort != NO_PORT) && (MapP->SysPort >= RIO_PORTS) ) | 626 | /* |
666 | { | 627 | ** Copy the name across to the map entry. |
667 | rio_dprintk (RIO_DEBUG_TABLE, "Port %d not valid!\n",(int)MapP->SysPort); | 628 | */ |
668 | p->RIOError.Error = TTY_NUMBER_OUT_OF_RANGE; | 629 | MapP->Name[MAX_NAME_LEN - 1] = '\0'; |
669 | return -EINVAL; | 630 | sptr = MapP->Name; |
670 | } | 631 | while (*sptr) { |
671 | 632 | if (*sptr < ' ' || *sptr > '~') { | |
672 | /* | 633 | rio_dprintk(RIO_DEBUG_TABLE, "Name entry contains non-printing characters!\n"); |
673 | ** Copy the name across to the map entry. | 634 | p->RIOError.Error = BAD_CHARACTER_IN_NAME; |
674 | */ | 635 | return -EINVAL; |
675 | MapP->Name[MAX_NAME_LEN-1] = '\0'; | ||
676 | sptr = MapP->Name; | ||
677 | while ( *sptr ) | ||
678 | { | ||
679 | if ( *sptr<' ' || *sptr>'~' ) | ||
680 | { | ||
681 | rio_dprintk (RIO_DEBUG_TABLE, "Name entry contains non-printing characters!\n"); | ||
682 | p->RIOError.Error = BAD_CHARACTER_IN_NAME; | ||
683 | return -EINVAL; | ||
684 | } | ||
685 | sptr++; | ||
686 | } | ||
687 | |||
688 | for ( host=0; host < p->RIONumHosts; host++ ) | ||
689 | { | ||
690 | if ( MapP->HostUniqueNum == p->RIOHosts[host].UniqueNum ) | ||
691 | { | ||
692 | if ( (p->RIOHosts[host].Flags & RUN_STATE) != RC_RUNNING ) | ||
693 | { | ||
694 | p->RIOError.Error = HOST_NOT_RUNNING; | ||
695 | return -ENXIO; | ||
696 | } | ||
697 | |||
698 | /* | ||
699 | ** Now we have a host we need to allocate an ID | ||
700 | ** if the entry does not already have one. | ||
701 | */ | ||
702 | if (MapP->ID == (ushort)-1) | ||
703 | { | ||
704 | int nNewID; | ||
705 | |||
706 | rio_dprintk (RIO_DEBUG_TABLE, "Attempting to get a new ID for rta \"%s\"\n", | ||
707 | MapP->Name); | ||
708 | /* | ||
709 | ** The idea here is to allow RTA's to be assigned | ||
710 | ** before they actually appear on the network. | ||
711 | ** This allows the addition of RTA's without having | ||
712 | ** to plug them in. | ||
713 | ** What we do is: | ||
714 | ** - Find a free ID and allocate it to the RTA. | ||
715 | ** - If this map entry is the second half of a | ||
716 | ** 16 port entry then find the other half and | ||
717 | ** make sure the 2 cross reference each other. | ||
718 | */ | ||
719 | if (RIOFindFreeID(p, &p->RIOHosts[host], &nNewID, NULL) != 0) | ||
720 | { | ||
721 | p->RIOError.Error = COULDNT_FIND_ENTRY; | ||
722 | return -EBUSY; | ||
723 | } | ||
724 | MapP->ID = (ushort)nNewID + 1; | ||
725 | rio_dprintk (RIO_DEBUG_TABLE, "Allocated ID %d for this new RTA.\n", MapP->ID); | ||
726 | HostMapP = &p->RIOHosts[host].Mapping[nNewID]; | ||
727 | HostMapP->RtaUniqueNum = MapP->RtaUniqueNum; | ||
728 | HostMapP->HostUniqueNum = MapP->HostUniqueNum; | ||
729 | HostMapP->ID = MapP->ID; | ||
730 | for (link = 0; link < LINKS_PER_UNIT; link++) | ||
731 | { | ||
732 | HostMapP->Topology[link].Unit = ROUTE_DISCONNECT; | ||
733 | HostMapP->Topology[link].Link = NO_LINK; | ||
734 | } | ||
735 | if (MapP->Flags & RTA16_SECOND_SLOT) | ||
736 | { | ||
737 | int unit; | ||
738 | |||
739 | for (unit = 0; unit < MAX_RUP; unit++) | ||
740 | if (p->RIOHosts[host].Mapping[unit].RtaUniqueNum == | ||
741 | MapP->RtaUniqueNum) | ||
742 | break; | ||
743 | if (unit == MAX_RUP) | ||
744 | { | ||
745 | p->RIOError.Error = COULDNT_FIND_ENTRY; | ||
746 | return -EBUSY; | ||
747 | } | ||
748 | HostMapP->Flags |= RTA16_SECOND_SLOT; | ||
749 | HostMapP->ID2 = MapP->ID2 = p->RIOHosts[host].Mapping[unit].ID; | ||
750 | p->RIOHosts[host].Mapping[unit].ID2 = MapP->ID; | ||
751 | rio_dprintk (RIO_DEBUG_TABLE, "Cross referenced id %d to ID %d.\n", | ||
752 | MapP->ID, | ||
753 | p->RIOHosts[host].Mapping[unit].ID); | ||
754 | } | 636 | } |
755 | } | 637 | sptr++; |
638 | } | ||
639 | |||
640 | for (host = 0; host < p->RIONumHosts; host++) { | ||
641 | if (MapP->HostUniqueNum == p->RIOHosts[host].UniqueNum) { | ||
642 | if ((p->RIOHosts[host].Flags & RUN_STATE) != RC_RUNNING) { | ||
643 | p->RIOError.Error = HOST_NOT_RUNNING; | ||
644 | return -ENXIO; | ||
645 | } | ||
756 | 646 | ||
757 | HostMapP = &p->RIOHosts[host].Mapping[MapP->ID-1]; | 647 | /* |
648 | ** Now we have a host we need to allocate an ID | ||
649 | ** if the entry does not already have one. | ||
650 | */ | ||
651 | if (MapP->ID == (ushort) - 1) { | ||
652 | int nNewID; | ||
758 | 653 | ||
759 | if ( HostMapP->Flags & SLOT_IN_USE ) | 654 | rio_dprintk(RIO_DEBUG_TABLE, "Attempting to get a new ID for rta \"%s\"\n", MapP->Name); |
760 | { | 655 | /* |
761 | rio_dprintk (RIO_DEBUG_TABLE, "Map table slot for ID %d is already in use.\n", MapP->ID); | 656 | ** The idea here is to allow RTA's to be assigned |
762 | p->RIOError.Error = ID_ALREADY_IN_USE; | 657 | ** before they actually appear on the network. |
763 | return -EBUSY; | 658 | ** This allows the addition of RTA's without having |
764 | } | 659 | ** to plug them in. |
765 | 660 | ** What we do is: | |
766 | /* | 661 | ** - Find a free ID and allocate it to the RTA. |
767 | ** Assign the sys ports and the name, and mark the slot as | 662 | ** - If this map entry is the second half of a |
768 | ** being in use. | 663 | ** 16 port entry then find the other half and |
769 | */ | 664 | ** make sure the 2 cross reference each other. |
770 | HostMapP->SysPort = MapP->SysPort; | 665 | */ |
771 | if ((MapP->Flags & RTA16_SECOND_SLOT) == 0) | 666 | if (RIOFindFreeID(p, &p->RIOHosts[host], &nNewID, NULL) != 0) { |
772 | CCOPY( MapP->Name, HostMapP->Name, MAX_NAME_LEN ); | 667 | p->RIOError.Error = COULDNT_FIND_ENTRY; |
773 | HostMapP->Flags = SLOT_IN_USE | RTA_BOOTED; | 668 | return -EBUSY; |
669 | } | ||
670 | MapP->ID = (ushort) nNewID + 1; | ||
671 | rio_dprintk(RIO_DEBUG_TABLE, "Allocated ID %d for this new RTA.\n", MapP->ID); | ||
672 | HostMapP = &p->RIOHosts[host].Mapping[nNewID]; | ||
673 | HostMapP->RtaUniqueNum = MapP->RtaUniqueNum; | ||
674 | HostMapP->HostUniqueNum = MapP->HostUniqueNum; | ||
675 | HostMapP->ID = MapP->ID; | ||
676 | for (link = 0; link < LINKS_PER_UNIT; link++) { | ||
677 | HostMapP->Topology[link].Unit = ROUTE_DISCONNECT; | ||
678 | HostMapP->Topology[link].Link = NO_LINK; | ||
679 | } | ||
680 | if (MapP->Flags & RTA16_SECOND_SLOT) { | ||
681 | int unit; | ||
682 | |||
683 | for (unit = 0; unit < MAX_RUP; unit++) | ||
684 | if (p->RIOHosts[host].Mapping[unit].RtaUniqueNum == MapP->RtaUniqueNum) | ||
685 | break; | ||
686 | if (unit == MAX_RUP) { | ||
687 | p->RIOError.Error = COULDNT_FIND_ENTRY; | ||
688 | return -EBUSY; | ||
689 | } | ||
690 | HostMapP->Flags |= RTA16_SECOND_SLOT; | ||
691 | HostMapP->ID2 = MapP->ID2 = p->RIOHosts[host].Mapping[unit].ID; | ||
692 | p->RIOHosts[host].Mapping[unit].ID2 = MapP->ID; | ||
693 | rio_dprintk(RIO_DEBUG_TABLE, "Cross referenced id %d to ID %d.\n", MapP->ID, p->RIOHosts[host].Mapping[unit].ID); | ||
694 | } | ||
695 | } | ||
696 | |||
697 | HostMapP = &p->RIOHosts[host].Mapping[MapP->ID - 1]; | ||
698 | |||
699 | if (HostMapP->Flags & SLOT_IN_USE) { | ||
700 | rio_dprintk(RIO_DEBUG_TABLE, "Map table slot for ID %d is already in use.\n", MapP->ID); | ||
701 | p->RIOError.Error = ID_ALREADY_IN_USE; | ||
702 | return -EBUSY; | ||
703 | } | ||
704 | |||
705 | /* | ||
706 | ** Assign the sys ports and the name, and mark the slot as | ||
707 | ** being in use. | ||
708 | */ | ||
709 | HostMapP->SysPort = MapP->SysPort; | ||
710 | if ((MapP->Flags & RTA16_SECOND_SLOT) == 0) | ||
711 | CCOPY(MapP->Name, HostMapP->Name, MAX_NAME_LEN); | ||
712 | HostMapP->Flags = SLOT_IN_USE | RTA_BOOTED; | ||
774 | #ifdef NEED_TO_FIX | 713 | #ifdef NEED_TO_FIX |
775 | RIO_SV_BROADCAST(p->RIOHosts[host].svFlags[MapP->ID-1]); | 714 | RIO_SV_BROADCAST(p->RIOHosts[host].svFlags[MapP->ID - 1]); |
776 | #endif | 715 | #endif |
777 | if (MapP->Flags & RTA16_SECOND_SLOT) | 716 | if (MapP->Flags & RTA16_SECOND_SLOT) |
778 | HostMapP->Flags |= RTA16_SECOND_SLOT; | 717 | HostMapP->Flags |= RTA16_SECOND_SLOT; |
779 | 718 | ||
780 | RIOReMapPorts( p, &p->RIOHosts[host], HostMapP ); | 719 | RIOReMapPorts(p, &p->RIOHosts[host], HostMapP); |
781 | /* | 720 | /* |
782 | ** Adjust 2nd block of 8 phbs | 721 | ** Adjust 2nd block of 8 phbs |
783 | */ | 722 | */ |
784 | if (MapP->Flags & RTA16_SECOND_SLOT) | 723 | if (MapP->Flags & RTA16_SECOND_SLOT) |
785 | RIOFixPhbs(p, &p->RIOHosts[host], HostMapP->ID - 1); | 724 | RIOFixPhbs(p, &p->RIOHosts[host], HostMapP->ID - 1); |
786 | 725 | ||
787 | if ( HostMapP->SysPort != NO_PORT ) | 726 | if (HostMapP->SysPort != NO_PORT) { |
788 | { | 727 | if (HostMapP->SysPort < p->RIOFirstPortsBooted) |
789 | if ( HostMapP->SysPort < p->RIOFirstPortsBooted ) | 728 | p->RIOFirstPortsBooted = HostMapP->SysPort; |
790 | p->RIOFirstPortsBooted = HostMapP->SysPort; | 729 | if (HostMapP->SysPort > p->RIOLastPortsBooted) |
791 | if ( HostMapP->SysPort > p->RIOLastPortsBooted ) | 730 | p->RIOLastPortsBooted = HostMapP->SysPort; |
792 | p->RIOLastPortsBooted = HostMapP->SysPort; | 731 | } |
793 | } | 732 | if (MapP->Flags & RTA16_SECOND_SLOT) |
794 | if (MapP->Flags & RTA16_SECOND_SLOT) | 733 | rio_dprintk(RIO_DEBUG_TABLE, "Second map of RTA %s added to configuration\n", p->RIOHosts[host].Mapping[MapP->ID2 - 1].Name); |
795 | rio_dprintk (RIO_DEBUG_TABLE, "Second map of RTA %s added to configuration\n", | 734 | else |
796 | p->RIOHosts[host].Mapping[MapP->ID2 - 1].Name); | 735 | rio_dprintk(RIO_DEBUG_TABLE, "RTA %s added to configuration\n", MapP->Name); |
797 | else | 736 | return 0; |
798 | rio_dprintk (RIO_DEBUG_TABLE, "RTA %s added to configuration\n", MapP->Name); | 737 | } |
799 | return 0; | ||
800 | } | 738 | } |
801 | } | 739 | p->RIOError.Error = UNKNOWN_HOST_NUMBER; |
802 | p->RIOError.Error = UNKNOWN_HOST_NUMBER; | 740 | rio_dprintk(RIO_DEBUG_TABLE, "Unknown host %x\n", MapP->HostUniqueNum); |
803 | rio_dprintk (RIO_DEBUG_TABLE, "Unknown host %x\n", MapP->HostUniqueNum); | 741 | return -ENXIO; |
804 | return -ENXIO; | ||
805 | } | 742 | } |
806 | 743 | ||
807 | 744 | ||
808 | int | 745 | int RIOReMapPorts(p, HostP, HostMapP) |
809 | RIOReMapPorts(p, HostP, HostMapP) | 746 | struct rio_info *p; |
810 | struct rio_info * p; | ||
811 | struct Host *HostP; | 747 | struct Host *HostP; |
812 | struct Map *HostMapP; | 748 | struct Map *HostMapP; |
813 | { | 749 | { |
814 | register struct Port *PortP; | 750 | register struct Port *PortP; |
815 | uint SubEnt; | 751 | uint SubEnt; |
@@ -819,135 +755,127 @@ struct Map *HostMapP; | |||
819 | unsigned long flags; | 755 | unsigned long flags; |
820 | 756 | ||
821 | #ifdef CHECK | 757 | #ifdef CHECK |
822 | CheckHostP( HostP ); | 758 | CheckHostP(HostP); |
823 | CheckHostMapP( HostMapP ); | 759 | CheckHostMapP(HostMapP); |
824 | #endif | 760 | #endif |
825 | 761 | ||
826 | rio_dprintk (RIO_DEBUG_TABLE, "Mapping sysport %d to id %d\n", (int)HostMapP->SysPort, HostMapP->ID); | 762 | rio_dprintk(RIO_DEBUG_TABLE, "Mapping sysport %d to id %d\n", (int) HostMapP->SysPort, HostMapP->ID); |
827 | 763 | ||
828 | /* | 764 | /* |
829 | ** We need to tell the UnixRups which sysport the rup corresponds to | 765 | ** We need to tell the UnixRups which sysport the rup corresponds to |
830 | */ | 766 | */ |
831 | HostP->UnixRups[HostMapP->ID-1].BaseSysPort = HostMapP->SysPort; | 767 | HostP->UnixRups[HostMapP->ID - 1].BaseSysPort = HostMapP->SysPort; |
832 | 768 | ||
833 | if ( HostMapP->SysPort == NO_PORT ) | 769 | if (HostMapP->SysPort == NO_PORT) |
834 | return(0); | 770 | return (0); |
835 | 771 | ||
836 | RtaType = GetUnitType(HostMapP->RtaUniqueNum); | 772 | RtaType = GetUnitType(HostMapP->RtaUniqueNum); |
837 | rio_dprintk (RIO_DEBUG_TABLE, "Mapping sysport %d-%d\n", | 773 | rio_dprintk(RIO_DEBUG_TABLE, "Mapping sysport %d-%d\n", (int) HostMapP->SysPort, (int) HostMapP->SysPort + PORTS_PER_RTA - 1); |
838 | (int)HostMapP->SysPort, (int)HostMapP->SysPort+PORTS_PER_RTA-1); | ||
839 | 774 | ||
840 | /* | 775 | /* |
841 | ** now map each of its eight ports | 776 | ** now map each of its eight ports |
842 | */ | 777 | */ |
843 | for ( SubEnt=0; SubEnt<PORTS_PER_RTA; SubEnt++) { | 778 | for (SubEnt = 0; SubEnt < PORTS_PER_RTA; SubEnt++) { |
844 | rio_dprintk (RIO_DEBUG_TABLE, "subent = %d, HostMapP->SysPort = %d\n", | 779 | rio_dprintk(RIO_DEBUG_TABLE, "subent = %d, HostMapP->SysPort = %d\n", SubEnt, (int) HostMapP->SysPort); |
845 | SubEnt, (int)HostMapP->SysPort); | 780 | SysPort = HostMapP->SysPort + SubEnt; /* portnumber within system */ |
846 | SysPort = HostMapP->SysPort+SubEnt; /* portnumber within system */ | 781 | /* portnumber on host */ |
847 | /* portnumber on host */ | 782 | |
848 | 783 | HostPort = (HostMapP->ID - 1) * PORTS_PER_RTA + SubEnt; | |
849 | HostPort = (HostMapP->ID-1)*PORTS_PER_RTA+SubEnt; | 784 | |
850 | 785 | rio_dprintk(RIO_DEBUG_TABLE, "c1 p = %p, p->rioPortp = %p\n", p, p->RIOPortp); | |
851 | rio_dprintk (RIO_DEBUG_TABLE, "c1 p = %p, p->rioPortp = %p\n", p, p->RIOPortp); | ||
852 | PortP = p->RIOPortp[SysPort]; | 786 | PortP = p->RIOPortp[SysPort]; |
853 | #if 0 | 787 | #if 0 |
854 | PortP->TtyP = &p->channel[SysPort]; | 788 | PortP->TtyP = &p->channel[SysPort]; |
855 | #endif | 789 | #endif |
856 | rio_dprintk (RIO_DEBUG_TABLE, "Map port\n"); | 790 | rio_dprintk(RIO_DEBUG_TABLE, "Map port\n"); |
857 | 791 | ||
858 | /* | 792 | /* |
859 | ** Point at all the real neat data structures | 793 | ** Point at all the real neat data structures |
860 | */ | 794 | */ |
861 | rio_spin_lock_irqsave(&PortP->portSem, flags); | 795 | rio_spin_lock_irqsave(&PortP->portSem, flags); |
862 | PortP->HostP = HostP; | 796 | PortP->HostP = HostP; |
863 | PortP->Caddr = HostP->Caddr; | 797 | PortP->Caddr = HostP->Caddr; |
864 | 798 | ||
865 | /* | 799 | /* |
866 | ** The PhbP cannot be filled in yet | 800 | ** The PhbP cannot be filled in yet |
867 | ** unless the host has been booted | 801 | ** unless the host has been booted |
868 | */ | 802 | */ |
869 | if ((HostP->Flags & RUN_STATE) == RC_RUNNING) { | 803 | if ((HostP->Flags & RUN_STATE) == RC_RUNNING) { |
870 | struct PHB *PhbP = PortP->PhbP = &HostP->PhbP[HostPort]; | 804 | struct PHB *PhbP = PortP->PhbP = &HostP->PhbP[HostPort]; |
871 | PortP->TxAdd =(WORD *)RIO_PTR(HostP->Caddr,RWORD(PhbP->tx_add)); | 805 | PortP->TxAdd = (WORD *) RIO_PTR(HostP->Caddr, RWORD(PhbP->tx_add)); |
872 | PortP->TxStart =(WORD *)RIO_PTR(HostP->Caddr,RWORD(PhbP->tx_start)); | 806 | PortP->TxStart = (WORD *) RIO_PTR(HostP->Caddr, RWORD(PhbP->tx_start)); |
873 | PortP->TxEnd =(WORD *)RIO_PTR(HostP->Caddr,RWORD(PhbP->tx_end)); | 807 | PortP->TxEnd = (WORD *) RIO_PTR(HostP->Caddr, RWORD(PhbP->tx_end)); |
874 | PortP->RxRemove=(WORD *)RIO_PTR(HostP->Caddr, | 808 | PortP->RxRemove = (WORD *) RIO_PTR(HostP->Caddr, RWORD(PhbP->rx_remove)); |
875 | RWORD(PhbP->rx_remove)); | 809 | PortP->RxStart = (WORD *) RIO_PTR(HostP->Caddr, RWORD(PhbP->rx_start)); |
876 | PortP->RxStart =(WORD *)RIO_PTR(HostP->Caddr,RWORD(PhbP->rx_start)); | 810 | PortP->RxEnd = (WORD *) RIO_PTR(HostP->Caddr, RWORD(PhbP->rx_end)); |
877 | PortP->RxEnd =(WORD *)RIO_PTR(HostP->Caddr,RWORD(PhbP->rx_end)); | 811 | } else |
878 | } | ||
879 | else | ||
880 | PortP->PhbP = NULL; | 812 | PortP->PhbP = NULL; |
881 | 813 | ||
882 | /* | 814 | /* |
883 | ** port related flags | 815 | ** port related flags |
884 | */ | 816 | */ |
885 | PortP->HostPort = HostPort; | 817 | PortP->HostPort = HostPort; |
886 | /* | 818 | /* |
887 | ** For each part of a 16 port RTA, RupNum is ID - 1. | 819 | ** For each part of a 16 port RTA, RupNum is ID - 1. |
888 | */ | 820 | */ |
889 | PortP->RupNum = HostMapP->ID - 1; | 821 | PortP->RupNum = HostMapP->ID - 1; |
890 | if (HostMapP->Flags & RTA16_SECOND_SLOT) { | 822 | if (HostMapP->Flags & RTA16_SECOND_SLOT) { |
891 | PortP->ID2 = HostMapP->ID2 - 1; | 823 | PortP->ID2 = HostMapP->ID2 - 1; |
892 | PortP->SecondBlock = TRUE; | 824 | PortP->SecondBlock = TRUE; |
893 | } | 825 | } else { |
894 | else { | 826 | PortP->ID2 = 0; |
895 | PortP->ID2 = 0; | 827 | PortP->SecondBlock = FALSE; |
896 | PortP->SecondBlock = FALSE; | ||
897 | } | 828 | } |
898 | PortP->RtaUniqueNum = HostMapP->RtaUniqueNum; | 829 | PortP->RtaUniqueNum = HostMapP->RtaUniqueNum; |
899 | 830 | ||
900 | /* | 831 | /* |
901 | ** If the port was already mapped then thats all we need to do. | 832 | ** If the port was already mapped then thats all we need to do. |
902 | */ | 833 | */ |
903 | if (PortP->Mapped) { | 834 | if (PortP->Mapped) { |
904 | rio_spin_unlock_irqrestore( &PortP->portSem, flags); | 835 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); |
905 | continue; | 836 | continue; |
906 | } | 837 | } else |
907 | else HostMapP->Flags &= ~RTA_NEWBOOT; | 838 | HostMapP->Flags &= ~RTA_NEWBOOT; |
908 | 839 | ||
909 | PortP->State = 0; | 840 | PortP->State = 0; |
910 | PortP->Config = 0; | 841 | PortP->Config = 0; |
911 | /* | 842 | /* |
912 | ** Check out the module type - if it is special (read only etc.) | 843 | ** Check out the module type - if it is special (read only etc.) |
913 | ** then we need to set flags in the PortP->Config. | 844 | ** then we need to set flags in the PortP->Config. |
914 | ** Note: For 16 port RTA, all ports are of the same type. | 845 | ** Note: For 16 port RTA, all ports are of the same type. |
915 | */ | 846 | */ |
916 | if (RtaType == TYPE_RTA16) { | 847 | if (RtaType == TYPE_RTA16) { |
917 | PortP->Config |= p->RIOModuleTypes[HostP->UnixRups | 848 | PortP->Config |= p->RIOModuleTypes[HostP->UnixRups[HostMapP->ID - 1].ModTypes].Flags[SubEnt % PORTS_PER_MODULE]; |
918 | [HostMapP->ID-1].ModTypes].Flags[SubEnt % PORTS_PER_MODULE]; | ||
919 | } else { | 849 | } else { |
920 | if ( SubEnt < PORTS_PER_MODULE ) | 850 | if (SubEnt < PORTS_PER_MODULE) |
921 | PortP->Config |= p->RIOModuleTypes[LONYBLE(HostP->UnixRups | 851 | PortP->Config |= p->RIOModuleTypes[LONYBLE(HostP->UnixRups[HostMapP->ID - 1].ModTypes)].Flags[SubEnt % PORTS_PER_MODULE]; |
922 | [HostMapP->ID-1].ModTypes)].Flags[SubEnt % PORTS_PER_MODULE]; | ||
923 | else | 852 | else |
924 | PortP->Config |= p->RIOModuleTypes[HINYBLE(HostP->UnixRups | 853 | PortP->Config |= p->RIOModuleTypes[HINYBLE(HostP->UnixRups[HostMapP->ID - 1].ModTypes)].Flags[SubEnt % PORTS_PER_MODULE]; |
925 | [HostMapP->ID-1].ModTypes)].Flags[SubEnt % PORTS_PER_MODULE]; | ||
926 | } | 854 | } |
927 | 855 | ||
928 | /* | 856 | /* |
929 | ** more port related flags | 857 | ** more port related flags |
930 | */ | 858 | */ |
931 | PortP->PortState = 0; | 859 | PortP->PortState = 0; |
932 | PortP->ModemLines = 0; | 860 | PortP->ModemLines = 0; |
933 | PortP->ModemState = 0; | 861 | PortP->ModemState = 0; |
934 | PortP->CookMode = COOK_WELL; | 862 | PortP->CookMode = COOK_WELL; |
935 | PortP->ParamSem = 0; | 863 | PortP->ParamSem = 0; |
936 | PortP->FlushCmdBodge= 0; | 864 | PortP->FlushCmdBodge = 0; |
937 | PortP->WflushFlag = 0; | 865 | PortP->WflushFlag = 0; |
938 | PortP->MagicFlags = 0; | 866 | PortP->MagicFlags = 0; |
939 | PortP->Lock = 0; | 867 | PortP->Lock = 0; |
940 | PortP->Store = 0; | 868 | PortP->Store = 0; |
941 | PortP->FirstOpen = 1; | 869 | PortP->FirstOpen = 1; |
942 | 870 | ||
943 | /* | 871 | /* |
944 | ** Buffers 'n things | 872 | ** Buffers 'n things |
945 | */ | 873 | */ |
946 | PortP->RxDataStart = 0; | 874 | PortP->RxDataStart = 0; |
947 | PortP->Cor2Copy = 0; | 875 | PortP->Cor2Copy = 0; |
948 | PortP->Name = &HostMapP->Name[0]; | 876 | PortP->Name = &HostMapP->Name[0]; |
949 | #ifdef STATS | 877 | #ifdef STATS |
950 | bzero( (caddr_t)&PortP->Stat, sizeof(struct RIOStats) ); | 878 | bzero((caddr_t) & PortP->Stat, sizeof(struct RIOStats)); |
951 | #endif | 879 | #endif |
952 | PortP->statsGather = 0; | 880 | PortP->statsGather = 0; |
953 | PortP->txchars = 0; | 881 | PortP->txchars = 0; |
@@ -955,90 +883,87 @@ struct Map *HostMapP; | |||
955 | PortP->opens = 0; | 883 | PortP->opens = 0; |
956 | PortP->closes = 0; | 884 | PortP->closes = 0; |
957 | PortP->ioctls = 0; | 885 | PortP->ioctls = 0; |
958 | if ( PortP->TxRingBuffer ) | 886 | if (PortP->TxRingBuffer) |
959 | bzero( PortP->TxRingBuffer, p->RIOBufferSize ); | 887 | bzero(PortP->TxRingBuffer, p->RIOBufferSize); |
960 | else if ( p->RIOBufferSize ) { | 888 | else if (p->RIOBufferSize) { |
961 | PortP->TxRingBuffer = sysbrk(p->RIOBufferSize); | 889 | PortP->TxRingBuffer = sysbrk(p->RIOBufferSize); |
962 | bzero( PortP->TxRingBuffer, p->RIOBufferSize ); | 890 | bzero(PortP->TxRingBuffer, p->RIOBufferSize); |
963 | } | 891 | } |
964 | PortP->TxBufferOut = 0; | 892 | PortP->TxBufferOut = 0; |
965 | PortP->TxBufferIn = 0; | 893 | PortP->TxBufferIn = 0; |
966 | PortP->Debug = 0; | 894 | PortP->Debug = 0; |
967 | /* | 895 | /* |
968 | ** LastRxTgl stores the state of the rx toggle bit for this | 896 | ** LastRxTgl stores the state of the rx toggle bit for this |
969 | ** port, to be compared with the state of the next pkt received. | 897 | ** port, to be compared with the state of the next pkt received. |
970 | ** If the same, we have received the same rx pkt from the RTA | 898 | ** If the same, we have received the same rx pkt from the RTA |
971 | ** twice. Initialise to a value not equal to PHB_RX_TGL or 0. | 899 | ** twice. Initialise to a value not equal to PHB_RX_TGL or 0. |
972 | */ | 900 | */ |
973 | PortP->LastRxTgl = ~(uchar)PHB_RX_TGL; | 901 | PortP->LastRxTgl = ~(uchar) PHB_RX_TGL; |
974 | 902 | ||
975 | /* | 903 | /* |
976 | ** and mark the port as usable | 904 | ** and mark the port as usable |
977 | */ | 905 | */ |
978 | PortP->Mapped = 1; | 906 | PortP->Mapped = 1; |
979 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | 907 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); |
980 | } | 908 | } |
981 | if ( HostMapP->SysPort < p->RIOFirstPortsMapped ) | 909 | if (HostMapP->SysPort < p->RIOFirstPortsMapped) |
982 | p->RIOFirstPortsMapped = HostMapP->SysPort; | 910 | p->RIOFirstPortsMapped = HostMapP->SysPort; |
983 | if ( HostMapP->SysPort > p->RIOLastPortsMapped ) | 911 | if (HostMapP->SysPort > p->RIOLastPortsMapped) |
984 | p->RIOLastPortsMapped = HostMapP->SysPort; | 912 | p->RIOLastPortsMapped = HostMapP->SysPort; |
985 | 913 | ||
986 | return 0; | 914 | return 0; |
987 | } | 915 | } |
988 | 916 | ||
989 | int | 917 | int RIOChangeName(p, MapP) |
990 | RIOChangeName(p, MapP) | ||
991 | struct rio_info *p; | 918 | struct rio_info *p; |
992 | struct Map* MapP; | 919 | struct Map *MapP; |
993 | { | 920 | { |
994 | int host; | 921 | int host; |
995 | struct Map *HostMapP; | 922 | struct Map *HostMapP; |
996 | char *sptr; | 923 | char *sptr; |
997 | 924 | ||
998 | rio_dprintk (RIO_DEBUG_TABLE, "Change name entry on host %x, rta %x, ID %d, Sysport %d\n", | 925 | 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); |
999 | MapP->HostUniqueNum,MapP->RtaUniqueNum, | ||
1000 | MapP->ID, (int)MapP->SysPort); | ||
1001 | 926 | ||
1002 | if ( MapP->ID > MAX_RUP ) { | 927 | if (MapP->ID > MAX_RUP) { |
1003 | rio_dprintk (RIO_DEBUG_TABLE, "Bad ID in map entry!\n"); | 928 | rio_dprintk(RIO_DEBUG_TABLE, "Bad ID in map entry!\n"); |
1004 | p->RIOError.Error = ID_NUMBER_OUT_OF_RANGE; | 929 | p->RIOError.Error = ID_NUMBER_OUT_OF_RANGE; |
1005 | return -EINVAL; | 930 | return -EINVAL; |
1006 | } | 931 | } |
1007 | 932 | ||
1008 | MapP->Name[MAX_NAME_LEN-1] = '\0'; | 933 | MapP->Name[MAX_NAME_LEN - 1] = '\0'; |
1009 | sptr = MapP->Name; | 934 | sptr = MapP->Name; |
1010 | 935 | ||
1011 | while ( *sptr ) { | 936 | while (*sptr) { |
1012 | if ( *sptr<' ' || *sptr>'~' ) { | 937 | if (*sptr < ' ' || *sptr > '~') { |
1013 | rio_dprintk (RIO_DEBUG_TABLE, "Name entry contains non-printing characters!\n"); | 938 | rio_dprintk(RIO_DEBUG_TABLE, "Name entry contains non-printing characters!\n"); |
1014 | p->RIOError.Error = BAD_CHARACTER_IN_NAME; | 939 | p->RIOError.Error = BAD_CHARACTER_IN_NAME; |
1015 | return -EINVAL; | 940 | return -EINVAL; |
1016 | } | 941 | } |
1017 | sptr++; | 942 | sptr++; |
1018 | } | 943 | } |
1019 | 944 | ||
1020 | for ( host=0; host < p->RIONumHosts; host++ ) { | 945 | for (host = 0; host < p->RIONumHosts; host++) { |
1021 | if ( MapP->HostUniqueNum == p->RIOHosts[host].UniqueNum ) { | 946 | if (MapP->HostUniqueNum == p->RIOHosts[host].UniqueNum) { |
1022 | if ( (p->RIOHosts[host].Flags & RUN_STATE) != RC_RUNNING ) { | 947 | if ((p->RIOHosts[host].Flags & RUN_STATE) != RC_RUNNING) { |
1023 | p->RIOError.Error = HOST_NOT_RUNNING; | 948 | p->RIOError.Error = HOST_NOT_RUNNING; |
1024 | return -ENXIO; | 949 | return -ENXIO; |
1025 | } | 950 | } |
1026 | if ( MapP->ID==0 ) { | 951 | if (MapP->ID == 0) { |
1027 | CCOPY( MapP->Name, p->RIOHosts[host].Name, MAX_NAME_LEN ); | 952 | CCOPY(MapP->Name, p->RIOHosts[host].Name, MAX_NAME_LEN); |
1028 | return 0; | 953 | return 0; |
1029 | } | 954 | } |
1030 | 955 | ||
1031 | HostMapP = &p->RIOHosts[host].Mapping[MapP->ID-1]; | 956 | HostMapP = &p->RIOHosts[host].Mapping[MapP->ID - 1]; |
1032 | 957 | ||
1033 | if ( HostMapP->RtaUniqueNum != MapP->RtaUniqueNum ) { | 958 | if (HostMapP->RtaUniqueNum != MapP->RtaUniqueNum) { |
1034 | p->RIOError.Error = RTA_NUMBER_WRONG; | 959 | p->RIOError.Error = RTA_NUMBER_WRONG; |
1035 | return -ENXIO; | 960 | return -ENXIO; |
1036 | } | 961 | } |
1037 | CCOPY( MapP->Name, HostMapP->Name, MAX_NAME_LEN ); | 962 | CCOPY(MapP->Name, HostMapP->Name, MAX_NAME_LEN); |
1038 | return 0; | 963 | return 0; |
1039 | } | 964 | } |
1040 | } | 965 | } |
1041 | p->RIOError.Error = UNKNOWN_HOST_NUMBER; | 966 | p->RIOError.Error = UNKNOWN_HOST_NUMBER; |
1042 | rio_dprintk (RIO_DEBUG_TABLE, "Unknown host %x\n", MapP->HostUniqueNum); | 967 | rio_dprintk(RIO_DEBUG_TABLE, "Unknown host %x\n", MapP->HostUniqueNum); |
1043 | return -ENXIO; | 968 | return -ENXIO; |
1044 | } | 969 | } |
diff --git a/drivers/char/rio/riotime.h b/drivers/char/rio/riotime.h index 66d52bc0549b..35e01cd103d0 100644 --- a/drivers/char/rio/riotime.h +++ b/drivers/char/rio/riotime.h | |||
@@ -40,7 +40,7 @@ | |||
40 | 40 | ||
41 | #ifndef lint | 41 | #ifndef lint |
42 | #ifdef SCCS | 42 | #ifdef SCCS |
43 | static char *_rio_riotime_h_sccs = "@(#)riotime.h 1.1" ; | 43 | static char *_rio_riotime_h_sccs = "@(#)riotime.h 1.1"; |
44 | #endif | 44 | #endif |
45 | #endif | 45 | #endif |
46 | 46 | ||
@@ -52,7 +52,7 @@ static char *_rio_riotime_h_sccs = "@(#)riotime.h 1.1" ; | |||
52 | /************************************** | 52 | /************************************** |
53 | * Convert a RIO tick (1/10th second) | 53 | * Convert a RIO tick (1/10th second) |
54 | * into transputer low priority ticks | 54 | * into transputer low priority ticks |
55 | *************************************/ | 55 | *************************************/ |
56 | #define RioTimeToLow(time) (time*(100000 / 64)) | 56 | #define RioTimeToLow(time) (time*(100000 / 64)) |
57 | #define RioLowToTime(time) ((time*64)/100000) | 57 | #define RioLowToTime(time) ((time*64)/100000) |
58 | 58 | ||
diff --git a/drivers/char/rio/riotty.c b/drivers/char/rio/riotty.c index 78a321afdf4f..5894a25b0113 100644 --- a/drivers/char/rio/riotty.c +++ b/drivers/char/rio/riotty.c | |||
@@ -90,21 +90,19 @@ static char *_riotty_c_sccs_ = "@(#)riotty.c 1.3"; | |||
90 | #include "sam.h" | 90 | #include "sam.h" |
91 | 91 | ||
92 | #if 0 | 92 | #if 0 |
93 | static void ttyseth_pv(struct Port *, struct ttystatics *, | 93 | static void ttyseth_pv(struct Port *, struct ttystatics *, struct termios *sg, int); |
94 | struct termios *sg, int); | ||
95 | #endif | 94 | #endif |
96 | 95 | ||
97 | static void RIOClearUp(struct Port *PortP); | 96 | static void RIOClearUp(struct Port *PortP); |
98 | int RIOShortCommand(struct rio_info *p, struct Port *PortP, | 97 | int RIOShortCommand(struct rio_info *p, struct Port *PortP, int command, int len, int arg); |
99 | int command, int len, int arg); | ||
100 | 98 | ||
101 | #if 0 | 99 | #if 0 |
102 | static int RIOCookMode(struct ttystatics *); | 100 | static int RIOCookMode(struct ttystatics *); |
103 | #endif | 101 | #endif |
104 | 102 | ||
105 | extern int conv_vb[]; /* now defined in ttymgr.c */ | 103 | extern int conv_vb[]; /* now defined in ttymgr.c */ |
106 | extern int conv_bv[]; /* now defined in ttymgr.c */ | 104 | extern int conv_bv[]; /* now defined in ttymgr.c */ |
107 | 105 | ||
108 | /* | 106 | /* |
109 | ** 16.09.1998 ARG - Fix to build riotty.k.o for Modular Kernel Support | 107 | ** 16.09.1998 ARG - Fix to build riotty.k.o for Modular Kernel Support |
110 | ** | 108 | ** |
@@ -117,27 +115,25 @@ extern int conv_bv[]; /* now defined in ttymgr.c */ | |||
117 | #endif | 115 | #endif |
118 | 116 | ||
119 | #ifdef NEED_THIS2 | 117 | #ifdef NEED_THIS2 |
120 | static struct old_sgttyb | 118 | static struct old_sgttyb default_sg = { |
121 | default_sg = | 119 | B19200, B19200, /* input and output speed */ |
122 | { | 120 | 'H' - '@', /* erase char */ |
123 | B19200, B19200, /* input and output speed */ | 121 | -1, /* 2nd erase char */ |
124 | 'H' - '@', /* erase char */ | 122 | 'U' - '@', /* kill char */ |
125 | -1, /* 2nd erase char */ | 123 | ECHO | CRMOD, /* mode */ |
126 | 'U' - '@', /* kill char */ | 124 | 'C' - '@', /* interrupt character */ |
127 | ECHO | CRMOD, /* mode */ | 125 | '\\' - '@', /* quit char */ |
128 | 'C' - '@', /* interrupt character */ | 126 | 'Q' - '@', /* start char */ |
129 | '\\' - '@', /* quit char */ | 127 | 'S' - '@', /* stop char */ |
130 | 'Q' - '@', /* start char */ | 128 | 'D' - '@', /* EOF */ |
131 | 'S' - '@', /* stop char */ | 129 | -1, /* brk */ |
132 | 'D' - '@', /* EOF */ | 130 | (LCRTBS | LCRTERA | LCRTKIL | LCTLECH), /* local mode word */ |
133 | -1, /* brk */ | 131 | 'Z' - '@', /* process stop */ |
134 | (LCRTBS | LCRTERA | LCRTKIL | LCTLECH), /* local mode word */ | 132 | 'Y' - '@', /* delayed stop */ |
135 | 'Z' - '@', /* process stop */ | 133 | 'R' - '@', /* reprint line */ |
136 | 'Y' - '@', /* delayed stop */ | 134 | 'O' - '@', /* flush output */ |
137 | 'R' - '@', /* reprint line */ | 135 | 'W' - '@', /* word erase */ |
138 | 'O' - '@', /* flush output */ | 136 | 'V' - '@' /* literal next char */ |
139 | 'W' - '@', /* word erase */ | ||
140 | 'V' - '@' /* literal next char */ | ||
141 | }; | 137 | }; |
142 | #endif | 138 | #endif |
143 | 139 | ||
@@ -145,62 +141,59 @@ default_sg = | |||
145 | extern struct rio_info *p; | 141 | extern struct rio_info *p; |
146 | 142 | ||
147 | 143 | ||
148 | int | 144 | int riotopen(struct tty_struct *tty, struct file *filp) |
149 | riotopen(struct tty_struct * tty, struct file * filp) | ||
150 | { | 145 | { |
151 | register uint SysPort; | 146 | register uint SysPort; |
152 | int Modem; | 147 | int Modem; |
153 | int repeat_this = 250; | 148 | int repeat_this = 250; |
154 | struct Port *PortP; /* pointer to the port structure */ | 149 | struct Port *PortP; /* pointer to the port structure */ |
155 | unsigned long flags; | 150 | unsigned long flags; |
156 | int retval = 0; | 151 | int retval = 0; |
157 | 152 | ||
158 | func_enter (); | 153 | func_enter(); |
159 | 154 | ||
160 | /* Make sure driver_data is NULL in case the rio isn't booted jet. Else gs_close | 155 | /* Make sure driver_data is NULL in case the rio isn't booted jet. Else gs_close |
161 | is going to oops. | 156 | is going to oops. |
162 | */ | 157 | */ |
163 | tty->driver_data = NULL; | 158 | tty->driver_data = NULL; |
164 | 159 | ||
165 | SysPort = rio_minor(tty); | 160 | SysPort = rio_minor(tty); |
166 | Modem = rio_ismodem(tty); | 161 | Modem = rio_ismodem(tty); |
167 | 162 | ||
168 | if ( p->RIOFailed ) { | 163 | if (p->RIOFailed) { |
169 | rio_dprintk (RIO_DEBUG_TTY, "System initialisation failed\n"); | 164 | rio_dprintk(RIO_DEBUG_TTY, "System initialisation failed\n"); |
170 | pseterr(ENXIO); | 165 | pseterr(ENXIO); |
171 | func_exit (); | 166 | func_exit(); |
172 | return -ENXIO; | 167 | return -ENXIO; |
173 | } | 168 | } |
174 | 169 | ||
175 | rio_dprintk (RIO_DEBUG_TTY, "port open SysPort %d (%s) (mapped:%d)\n", | 170 | rio_dprintk(RIO_DEBUG_TTY, "port open SysPort %d (%s) (mapped:%d)\n", SysPort, Modem ? "Modem" : "tty", p->RIOPortp[SysPort]->Mapped); |
176 | SysPort, Modem ? "Modem" : "tty", | ||
177 | p->RIOPortp[SysPort]->Mapped); | ||
178 | 171 | ||
179 | /* | 172 | /* |
180 | ** Validate that we have received a legitimate request. | 173 | ** Validate that we have received a legitimate request. |
181 | ** Currently, just check that we are opening a port on | 174 | ** Currently, just check that we are opening a port on |
182 | ** a host card that actually exists, and that the port | 175 | ** a host card that actually exists, and that the port |
183 | ** has been mapped onto a host. | 176 | ** has been mapped onto a host. |
184 | */ | 177 | */ |
185 | if (SysPort >= RIO_PORTS) { /* out of range ? */ | 178 | if (SysPort >= RIO_PORTS) { /* out of range ? */ |
186 | rio_dprintk (RIO_DEBUG_TTY, "Illegal port number %d\n",SysPort); | 179 | rio_dprintk(RIO_DEBUG_TTY, "Illegal port number %d\n", SysPort); |
187 | pseterr(ENXIO); | 180 | pseterr(ENXIO); |
188 | func_exit(); | 181 | func_exit(); |
189 | return -ENXIO; | 182 | return -ENXIO; |
190 | } | 183 | } |
191 | 184 | ||
192 | /* | 185 | /* |
193 | ** Grab pointer to the port stucture | 186 | ** Grab pointer to the port stucture |
194 | */ | 187 | */ |
195 | PortP = p->RIOPortp[SysPort]; /* Get control struc */ | 188 | PortP = p->RIOPortp[SysPort]; /* Get control struc */ |
196 | rio_dprintk (RIO_DEBUG_TTY, "PortP: %p\n", PortP); | 189 | rio_dprintk(RIO_DEBUG_TTY, "PortP: %p\n", PortP); |
197 | if ( !PortP->Mapped ) { /* we aren't mapped yet! */ | 190 | if (!PortP->Mapped) { /* we aren't mapped yet! */ |
198 | /* | 191 | /* |
199 | ** The system doesn't know which RTA this port | 192 | ** The system doesn't know which RTA this port |
200 | ** corresponds to. | 193 | ** corresponds to. |
201 | */ | 194 | */ |
202 | rio_dprintk (RIO_DEBUG_TTY, "port not mapped into system\n"); | 195 | rio_dprintk(RIO_DEBUG_TTY, "port not mapped into system\n"); |
203 | func_exit (); | 196 | func_exit(); |
204 | pseterr(ENXIO); | 197 | pseterr(ENXIO); |
205 | return -ENXIO; | 198 | return -ENXIO; |
206 | } | 199 | } |
@@ -210,132 +203,131 @@ riotopen(struct tty_struct * tty, struct file * filp) | |||
210 | PortP->gs.tty = tty; | 203 | PortP->gs.tty = tty; |
211 | PortP->gs.count++; | 204 | PortP->gs.count++; |
212 | 205 | ||
213 | rio_dprintk (RIO_DEBUG_TTY, "%d bytes in tx buffer\n", | 206 | rio_dprintk(RIO_DEBUG_TTY, "%d bytes in tx buffer\n", PortP->gs.xmit_cnt); |
214 | PortP->gs.xmit_cnt); | ||
215 | 207 | ||
216 | retval = gs_init_port (&PortP->gs); | 208 | retval = gs_init_port(&PortP->gs); |
217 | if (retval) { | 209 | if (retval) { |
218 | PortP->gs.count--; | 210 | PortP->gs.count--; |
219 | return -ENXIO; | 211 | return -ENXIO; |
220 | } | 212 | } |
221 | /* | 213 | /* |
222 | ** If the host hasn't been booted yet, then | 214 | ** If the host hasn't been booted yet, then |
223 | ** fail | 215 | ** fail |
224 | */ | 216 | */ |
225 | if ( (PortP->HostP->Flags & RUN_STATE) != RC_RUNNING ) { | 217 | if ((PortP->HostP->Flags & RUN_STATE) != RC_RUNNING) { |
226 | rio_dprintk (RIO_DEBUG_TTY, "Host not running\n"); | 218 | rio_dprintk(RIO_DEBUG_TTY, "Host not running\n"); |
227 | pseterr(ENXIO); | 219 | pseterr(ENXIO); |
228 | func_exit (); | 220 | func_exit(); |
229 | return -ENXIO; | 221 | return -ENXIO; |
230 | } | 222 | } |
231 | 223 | ||
232 | /* | 224 | /* |
233 | ** If the RTA has not booted yet and the user has choosen to block | 225 | ** If the RTA has not booted yet and the user has choosen to block |
234 | ** until the RTA is present then we must spin here waiting for | 226 | ** until the RTA is present then we must spin here waiting for |
235 | ** the RTA to boot. | 227 | ** the RTA to boot. |
236 | */ | 228 | */ |
237 | #if 0 | 229 | #if 0 |
238 | if (!(PortP->HostP->Mapping[PortP->RupNum].Flags & RTA_BOOTED)) { | 230 | if (!(PortP->HostP->Mapping[PortP->RupNum].Flags & RTA_BOOTED)) { |
239 | if (PortP->WaitUntilBooted) { | 231 | if (PortP->WaitUntilBooted) { |
240 | rio_dprintk (RIO_DEBUG_TTY, "Waiting for RTA to boot\n"); | 232 | rio_dprintk(RIO_DEBUG_TTY, "Waiting for RTA to boot\n"); |
241 | do { | 233 | do { |
242 | if (RIODelay(PortP, HUNDRED_MS) == RIO_FAIL) { | 234 | if (RIODelay(PortP, HUNDRED_MS) == RIO_FAIL) { |
243 | rio_dprintk (RIO_DEBUG_TTY, "RTA EINTR in delay \n"); | 235 | rio_dprintk(RIO_DEBUG_TTY, "RTA EINTR in delay \n"); |
244 | func_exit (); | 236 | func_exit(); |
245 | return -EINTR; | 237 | return -EINTR; |
246 | } | 238 | } |
247 | if (repeat_this -- <= 0) { | 239 | if (repeat_this-- <= 0) { |
248 | rio_dprintk (RIO_DEBUG_TTY, "Waiting for RTA to boot timeout\n"); | 240 | rio_dprintk(RIO_DEBUG_TTY, "Waiting for RTA to boot timeout\n"); |
249 | RIOPreemptiveCmd(p, PortP, FCLOSE ); | 241 | RIOPreemptiveCmd(p, PortP, FCLOSE); |
250 | pseterr(EINTR); | 242 | pseterr(EINTR); |
251 | func_exit (); | 243 | func_exit(); |
252 | return -EIO; | 244 | return -EIO; |
253 | } | 245 | } |
254 | } while(!(PortP->HostP->Mapping[PortP->RupNum].Flags & RTA_BOOTED)); | 246 | } while (!(PortP->HostP->Mapping[PortP->RupNum].Flags & RTA_BOOTED)); |
255 | rio_dprintk (RIO_DEBUG_TTY, "RTA has been booted\n"); | 247 | rio_dprintk(RIO_DEBUG_TTY, "RTA has been booted\n"); |
256 | } else { | 248 | } else { |
257 | rio_dprintk (RIO_DEBUG_TTY, "RTA never booted\n"); | 249 | rio_dprintk(RIO_DEBUG_TTY, "RTA never booted\n"); |
258 | pseterr(ENXIO); | 250 | pseterr(ENXIO); |
259 | func_exit (); | 251 | func_exit(); |
260 | return 0; | 252 | return 0; |
261 | } | 253 | } |
262 | } | 254 | } |
263 | #else | 255 | #else |
264 | /* I find the above code a bit hairy. I find the below code | 256 | /* I find the above code a bit hairy. I find the below code |
265 | easier to read and shorter. Now, if it works too that would | 257 | easier to read and shorter. Now, if it works too that would |
266 | be great... -- REW | 258 | be great... -- REW |
267 | */ | 259 | */ |
268 | rio_dprintk (RIO_DEBUG_TTY, "Checking if RTA has booted... \n"); | 260 | rio_dprintk(RIO_DEBUG_TTY, "Checking if RTA has booted... \n"); |
269 | while (!(PortP->HostP->Mapping[PortP->RupNum].Flags & RTA_BOOTED)) { | 261 | while (!(PortP->HostP->Mapping[PortP->RupNum].Flags & RTA_BOOTED)) { |
270 | if (!PortP->WaitUntilBooted) { | 262 | if (!PortP->WaitUntilBooted) { |
271 | rio_dprintk (RIO_DEBUG_TTY, "RTA never booted\n"); | 263 | rio_dprintk(RIO_DEBUG_TTY, "RTA never booted\n"); |
272 | func_exit (); | 264 | func_exit(); |
273 | return -ENXIO; | 265 | return -ENXIO; |
274 | } | 266 | } |
275 | 267 | ||
276 | /* Under Linux you'd normally use a wait instead of this | 268 | /* Under Linux you'd normally use a wait instead of this |
277 | busy-waiting. I'll stick with the old implementation for | 269 | busy-waiting. I'll stick with the old implementation for |
278 | now. --REW | 270 | now. --REW |
279 | */ | 271 | */ |
280 | if (RIODelay(PortP, HUNDRED_MS) == RIO_FAIL) { | 272 | if (RIODelay(PortP, HUNDRED_MS) == RIO_FAIL) { |
281 | rio_dprintk (RIO_DEBUG_TTY, "RTA_wait_for_boot: EINTR in delay \n"); | 273 | rio_dprintk(RIO_DEBUG_TTY, "RTA_wait_for_boot: EINTR in delay \n"); |
282 | func_exit (); | 274 | func_exit(); |
283 | return -EINTR; | 275 | return -EINTR; |
284 | } | 276 | } |
285 | if (repeat_this -- <= 0) { | 277 | if (repeat_this-- <= 0) { |
286 | rio_dprintk (RIO_DEBUG_TTY, "Waiting for RTA to boot timeout\n"); | 278 | rio_dprintk(RIO_DEBUG_TTY, "Waiting for RTA to boot timeout\n"); |
287 | func_exit (); | 279 | func_exit(); |
288 | return -EIO; | 280 | return -EIO; |
289 | } | 281 | } |
290 | } | 282 | } |
291 | rio_dprintk (RIO_DEBUG_TTY, "RTA has been booted\n"); | 283 | rio_dprintk(RIO_DEBUG_TTY, "RTA has been booted\n"); |
292 | #endif | 284 | #endif |
293 | #if 0 | 285 | #if 0 |
294 | tp = PortP->TtyP; /* get tty struct */ | 286 | tp = PortP->TtyP; /* get tty struct */ |
295 | #endif | 287 | #endif |
296 | rio_spin_lock_irqsave(&PortP->portSem, flags); | 288 | rio_spin_lock_irqsave(&PortP->portSem, flags); |
297 | if ( p->RIOHalted ) { | 289 | if (p->RIOHalted) { |
298 | goto bombout; | 290 | goto bombout; |
299 | } | 291 | } |
300 | #if 0 | 292 | #if 0 |
301 | retval = gs_init_port(&PortP->gs); | 293 | retval = gs_init_port(&PortP->gs); |
302 | if (retval){ | 294 | if (retval) { |
303 | func_exit (); | 295 | func_exit(); |
304 | return retval; | 296 | return retval; |
305 | } | 297 | } |
306 | #endif | 298 | #endif |
307 | 299 | ||
308 | /* | 300 | /* |
309 | ** If the port is in the final throws of being closed, | 301 | ** If the port is in the final throws of being closed, |
310 | ** we should wait here (politely), waiting | 302 | ** we should wait here (politely), waiting |
311 | ** for it to finish, so that it doesn't close us! | 303 | ** for it to finish, so that it doesn't close us! |
312 | */ | 304 | */ |
313 | while ( (PortP->State & RIO_CLOSING) && !p->RIOHalted ) { | 305 | while ((PortP->State & RIO_CLOSING) && !p->RIOHalted) { |
314 | rio_dprintk (RIO_DEBUG_TTY, "Waiting for RIO_CLOSING to go away\n"); | 306 | rio_dprintk(RIO_DEBUG_TTY, "Waiting for RIO_CLOSING to go away\n"); |
315 | if (repeat_this -- <= 0) { | 307 | if (repeat_this-- <= 0) { |
316 | rio_dprintk (RIO_DEBUG_TTY, "Waiting for not idle closed broken by signal\n"); | 308 | rio_dprintk(RIO_DEBUG_TTY, "Waiting for not idle closed broken by signal\n"); |
317 | RIOPreemptiveCmd(p, PortP, FCLOSE ); | 309 | RIOPreemptiveCmd(p, PortP, FCLOSE); |
318 | retval = -EINTR; | 310 | retval = -EINTR; |
319 | goto bombout; | 311 | goto bombout; |
320 | } | 312 | } |
321 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | 313 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); |
322 | if (RIODelay(PortP, HUNDRED_MS) == RIO_FAIL) { | 314 | if (RIODelay(PortP, HUNDRED_MS) == RIO_FAIL) { |
323 | rio_spin_lock_irqsave(&PortP->portSem, flags); | 315 | rio_spin_lock_irqsave(&PortP->portSem, flags); |
324 | retval = -EINTR; | 316 | retval = -EINTR; |
325 | goto bombout; | 317 | goto bombout; |
326 | } | 318 | } |
327 | rio_spin_lock_irqsave(&PortP->portSem, flags); | 319 | rio_spin_lock_irqsave(&PortP->portSem, flags); |
328 | } | 320 | } |
329 | 321 | ||
330 | if ( !PortP->Mapped ) { | 322 | if (!PortP->Mapped) { |
331 | rio_dprintk (RIO_DEBUG_TTY, "Port unmapped while closing!\n"); | 323 | rio_dprintk(RIO_DEBUG_TTY, "Port unmapped while closing!\n"); |
332 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | 324 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); |
333 | retval = -ENXIO; | 325 | retval = -ENXIO; |
334 | func_exit (); | 326 | func_exit(); |
335 | return retval; | 327 | return retval; |
336 | } | 328 | } |
337 | 329 | ||
338 | if ( p->RIOHalted ) { | 330 | if (p->RIOHalted) { |
339 | goto bombout; | 331 | goto bombout; |
340 | } | 332 | } |
341 | 333 | ||
@@ -346,16 +338,16 @@ riotopen(struct tty_struct * tty, struct file * filp) | |||
346 | */ | 338 | */ |
347 | /* Uh? Suppose I turn these on and then another process opens | 339 | /* Uh? Suppose I turn these on and then another process opens |
348 | the port again? The flags get cleared! Not good. -- REW */ | 340 | the port again? The flags get cleared! Not good. -- REW */ |
349 | if ( !(PortP->State & (RIO_LOPEN | RIO_MOPEN)) ) { | 341 | if (!(PortP->State & (RIO_LOPEN | RIO_MOPEN))) { |
350 | PortP->Config &= ~(RIO_CTSFLOW|RIO_RTSFLOW); | 342 | PortP->Config &= ~(RIO_CTSFLOW | RIO_RTSFLOW); |
351 | } | 343 | } |
352 | 344 | ||
353 | if (!(PortP->firstOpen)) { /* First time ? */ | 345 | if (!(PortP->firstOpen)) { /* First time ? */ |
354 | rio_dprintk (RIO_DEBUG_TTY, "First open for this port\n"); | 346 | rio_dprintk(RIO_DEBUG_TTY, "First open for this port\n"); |
355 | 347 | ||
356 | 348 | ||
357 | PortP->firstOpen++; | 349 | PortP->firstOpen++; |
358 | PortP->CookMode = 0; /* XXX RIOCookMode(tp); */ | 350 | PortP->CookMode = 0; /* XXX RIOCookMode(tp); */ |
359 | PortP->InUse = NOT_INUSE; | 351 | PortP->InUse = NOT_INUSE; |
360 | 352 | ||
361 | /* Tentative fix for bug PR27. Didn't work. */ | 353 | /* Tentative fix for bug PR27. Didn't work. */ |
@@ -363,26 +355,26 @@ riotopen(struct tty_struct * tty, struct file * filp) | |||
363 | 355 | ||
364 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | 356 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); |
365 | #ifdef NEED_THIS | 357 | #ifdef NEED_THIS |
366 | ttyseth(PortP, tp, (struct old_sgttyb *)&default_sg); | 358 | ttyseth(PortP, tp, (struct old_sgttyb *) &default_sg); |
367 | #endif | 359 | #endif |
368 | 360 | ||
369 | /* Someone explain to me why this delay/config is | 361 | /* Someone explain to me why this delay/config is |
370 | here. If I read the docs correctly the "open" | 362 | here. If I read the docs correctly the "open" |
371 | command piggybacks the parameters immediately. | 363 | command piggybacks the parameters immediately. |
372 | -- REW */ | 364 | -- REW */ |
373 | RIOParam(PortP,OPEN,Modem,OK_TO_SLEEP); /* Open the port */ | 365 | RIOParam(PortP, OPEN, Modem, OK_TO_SLEEP); /* Open the port */ |
374 | #if 0 | 366 | #if 0 |
375 | /* This delay of 1 second was annoying. I removed it. -- REW */ | 367 | /* This delay of 1 second was annoying. I removed it. -- REW */ |
376 | RIODelay(PortP, HUNDRED_MS*10); | 368 | RIODelay(PortP, HUNDRED_MS * 10); |
377 | RIOParam(PortP,CONFIG,Modem,OK_TO_SLEEP); /* Config the port */ | 369 | RIOParam(PortP, CONFIG, Modem, OK_TO_SLEEP); /* Config the port */ |
378 | #endif | 370 | #endif |
379 | rio_spin_lock_irqsave(&PortP->portSem, flags); | 371 | rio_spin_lock_irqsave(&PortP->portSem, flags); |
380 | 372 | ||
381 | /* | 373 | /* |
382 | ** wait for the port to be not closed. | 374 | ** wait for the port to be not closed. |
383 | */ | 375 | */ |
384 | while ( !(PortP->PortState & PORT_ISOPEN) && !p->RIOHalted ) { | 376 | while (!(PortP->PortState & PORT_ISOPEN) && !p->RIOHalted) { |
385 | rio_dprintk (RIO_DEBUG_TTY, "Waiting for PORT_ISOPEN-currently %x\n",PortP->PortState); | 377 | rio_dprintk(RIO_DEBUG_TTY, "Waiting for PORT_ISOPEN-currently %x\n", PortP->PortState); |
386 | /* | 378 | /* |
387 | ** 15.10.1998 ARG - ESIL 0759 | 379 | ** 15.10.1998 ARG - ESIL 0759 |
388 | ** (Part) fix for port being trashed when opened whilst RTA "disconnected" | 380 | ** (Part) fix for port being trashed when opened whilst RTA "disconnected" |
@@ -399,115 +391,109 @@ riotopen(struct tty_struct * tty, struct file * filp) | |||
399 | */ | 391 | */ |
400 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | 392 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); |
401 | if (RIODelay(PortP, HUNDRED_MS) == RIO_FAIL) { | 393 | if (RIODelay(PortP, HUNDRED_MS) == RIO_FAIL) { |
402 | rio_dprintk (RIO_DEBUG_TTY, "Waiting for open to finish broken by signal\n"); | 394 | rio_dprintk(RIO_DEBUG_TTY, "Waiting for open to finish broken by signal\n"); |
403 | RIOPreemptiveCmd(p, PortP, FCLOSE ); | 395 | RIOPreemptiveCmd(p, PortP, FCLOSE); |
404 | func_exit (); | 396 | func_exit(); |
405 | return -EINTR; | 397 | return -EINTR; |
406 | } | 398 | } |
407 | rio_spin_lock_irqsave(&PortP->portSem, flags); | 399 | rio_spin_lock_irqsave(&PortP->portSem, flags); |
408 | } | 400 | } |
409 | 401 | ||
410 | if ( p->RIOHalted ) { | 402 | if (p->RIOHalted) { |
411 | retval = -EIO; | 403 | retval = -EIO; |
412 | bombout: | 404 | bombout: |
413 | /* RIOClearUp( PortP ); */ | 405 | /* RIOClearUp( PortP ); */ |
414 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | 406 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); |
415 | return retval; | 407 | return retval; |
416 | } | 408 | } |
417 | rio_dprintk (RIO_DEBUG_TTY, "PORT_ISOPEN found\n"); | 409 | rio_dprintk(RIO_DEBUG_TTY, "PORT_ISOPEN found\n"); |
418 | } | 410 | } |
419 | 411 | #ifdef MODEM_SUPPORT | |
420 | #ifdef MODEM_SUPPORT | ||
421 | if (Modem) { | 412 | if (Modem) { |
422 | rio_dprintk (RIO_DEBUG_TTY, "Modem - test for carrier\n"); | 413 | rio_dprintk(RIO_DEBUG_TTY, "Modem - test for carrier\n"); |
423 | /* | 414 | /* |
424 | ** ACTION | 415 | ** ACTION |
425 | ** insert test for carrier here. -- ??? | 416 | ** insert test for carrier here. -- ??? |
426 | ** I already see that test here. What's the deal? -- REW | 417 | ** I already see that test here. What's the deal? -- REW |
427 | */ | 418 | */ |
428 | if ((PortP->gs.tty->termios->c_cflag & CLOCAL) || (PortP->ModemState & MSVR1_CD)) | 419 | if ((PortP->gs.tty->termios->c_cflag & CLOCAL) || (PortP->ModemState & MSVR1_CD)) { |
429 | { | 420 | rio_dprintk(RIO_DEBUG_TTY, "open(%d) Modem carr on\n", SysPort); |
430 | rio_dprintk (RIO_DEBUG_TTY, "open(%d) Modem carr on\n", SysPort); | ||
431 | /* | 421 | /* |
432 | tp->tm.c_state |= CARR_ON; | 422 | tp->tm.c_state |= CARR_ON; |
433 | wakeup((caddr_t) &tp->tm.c_canq); | 423 | wakeup((caddr_t) &tp->tm.c_canq); |
434 | */ | 424 | */ |
435 | PortP->State |= RIO_CARR_ON; | 425 | PortP->State |= RIO_CARR_ON; |
436 | wake_up_interruptible (&PortP->gs.open_wait); | 426 | wake_up_interruptible(&PortP->gs.open_wait); |
437 | } | 427 | } else { /* no carrier - wait for DCD */ |
438 | else /* no carrier - wait for DCD */ | 428 | |
439 | { | 429 | /* |
440 | /* | 430 | while (!(PortP->gs.tty->termios->c_state & CARR_ON) && |
441 | while (!(PortP->gs.tty->termios->c_state & CARR_ON) && | 431 | !(filp->f_flags & O_NONBLOCK) && !p->RIOHalted ) |
442 | !(filp->f_flags & O_NONBLOCK) && !p->RIOHalted ) | 432 | */ |
443 | */ | 433 | while (!(PortP->State & RIO_CARR_ON) && !(filp->f_flags & O_NONBLOCK) && !p->RIOHalted) { |
444 | while (!(PortP->State & RIO_CARR_ON) && | 434 | |
445 | !(filp->f_flags & O_NONBLOCK) && !p->RIOHalted ) { | 435 | rio_dprintk(RIO_DEBUG_TTY, "open(%d) sleeping for carr on\n", SysPort); |
446 | |||
447 | rio_dprintk (RIO_DEBUG_TTY, "open(%d) sleeping for carr on\n",SysPort); | ||
448 | /* | 436 | /* |
449 | PortP->gs.tty->termios->c_state |= WOPEN; | 437 | PortP->gs.tty->termios->c_state |= WOPEN; |
450 | */ | 438 | */ |
451 | PortP->State |= RIO_WOPEN; | 439 | PortP->State |= RIO_WOPEN; |
452 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | 440 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); |
453 | if (RIODelay (PortP, HUNDRED_MS) == RIO_FAIL) | 441 | if (RIODelay(PortP, HUNDRED_MS) == RIO_FAIL) |
454 | #if 0 | 442 | #if 0 |
455 | if ( sleep((caddr_t)&tp->tm.c_canqo, TTIPRI|PCATCH)) | 443 | if (sleep((caddr_t) & tp->tm.c_canqo, TTIPRI | PCATCH)) |
456 | #endif | 444 | #endif |
457 | { | 445 | { |
458 | /* | 446 | /* |
459 | ** ACTION: verify that this is a good thing | 447 | ** ACTION: verify that this is a good thing |
460 | ** to do here. -- ??? | 448 | ** to do here. -- ??? |
461 | ** I think it's OK. -- REW | 449 | ** I think it's OK. -- REW |
462 | */ | 450 | */ |
463 | rio_dprintk (RIO_DEBUG_TTY, "open(%d) sleeping for carr broken by signal\n", | 451 | rio_dprintk(RIO_DEBUG_TTY, "open(%d) sleeping for carr broken by signal\n", SysPort); |
464 | SysPort); | 452 | RIOPreemptiveCmd(p, PortP, FCLOSE); |
465 | RIOPreemptiveCmd( p, PortP, FCLOSE ); | 453 | /* |
466 | /* | 454 | tp->tm.c_state &= ~WOPEN; |
467 | tp->tm.c_state &= ~WOPEN; | 455 | */ |
468 | */ | 456 | PortP->State &= ~RIO_WOPEN; |
469 | PortP->State &= ~RIO_WOPEN; | 457 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); |
470 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | 458 | func_exit(); |
471 | func_exit (); | 459 | return -EINTR; |
472 | return -EINTR; | 460 | } |
473 | } | ||
474 | } | 461 | } |
475 | PortP->State &= ~RIO_WOPEN; | 462 | PortP->State &= ~RIO_WOPEN; |
476 | } | 463 | } |
477 | if ( p->RIOHalted ) | 464 | if (p->RIOHalted) |
478 | goto bombout; | 465 | goto bombout; |
479 | rio_dprintk (RIO_DEBUG_TTY, "Setting RIO_MOPEN\n"); | 466 | rio_dprintk(RIO_DEBUG_TTY, "Setting RIO_MOPEN\n"); |
480 | PortP->State |= RIO_MOPEN; | 467 | PortP->State |= RIO_MOPEN; |
481 | } | 468 | } else |
482 | else | ||
483 | #endif | 469 | #endif |
484 | { | 470 | { |
485 | /* | 471 | /* |
486 | ** ACTION | 472 | ** ACTION |
487 | ** Direct line open - force carrier (will probably mean | 473 | ** Direct line open - force carrier (will probably mean |
488 | ** that sleeping Modem line fubar) | 474 | ** that sleeping Modem line fubar) |
489 | */ | 475 | */ |
490 | PortP->State |= RIO_LOPEN; | 476 | PortP->State |= RIO_LOPEN; |
491 | } | 477 | } |
492 | 478 | ||
493 | if ( p->RIOHalted ) { | 479 | if (p->RIOHalted) { |
494 | goto bombout; | 480 | goto bombout; |
495 | } | 481 | } |
496 | 482 | ||
497 | rio_dprintk (RIO_DEBUG_TTY, "high level open done\n"); | 483 | rio_dprintk(RIO_DEBUG_TTY, "high level open done\n"); |
498 | 484 | ||
499 | #ifdef STATS | 485 | #ifdef STATS |
500 | PortP->Stat.OpenCnt++; | 486 | PortP->Stat.OpenCnt++; |
501 | #endif | 487 | #endif |
502 | /* | 488 | /* |
503 | ** Count opens for port statistics reporting | 489 | ** Count opens for port statistics reporting |
504 | */ | 490 | */ |
505 | if (PortP->statsGather) | 491 | if (PortP->statsGather) |
506 | PortP->opens++; | 492 | PortP->opens++; |
507 | 493 | ||
508 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | 494 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); |
509 | rio_dprintk (RIO_DEBUG_TTY, "Returning from open\n"); | 495 | rio_dprintk(RIO_DEBUG_TTY, "Returning from open\n"); |
510 | func_exit (); | 496 | func_exit(); |
511 | return 0; | 497 | return 0; |
512 | } | 498 | } |
513 | 499 | ||
@@ -516,36 +502,35 @@ bombout: | |||
516 | ** The operating system thinks that this is last close for the device. | 502 | ** The operating system thinks that this is last close for the device. |
517 | ** As there are two interfaces to the port (Modem and tty), we need to | 503 | ** As there are two interfaces to the port (Modem and tty), we need to |
518 | ** check that both are closed before we close the device. | 504 | ** check that both are closed before we close the device. |
519 | */ | 505 | */ |
520 | int | 506 | int riotclose(void *ptr) |
521 | riotclose(void *ptr) | ||
522 | { | 507 | { |
523 | #if 0 | 508 | #if 0 |
524 | register uint SysPort = dev; | 509 | register uint SysPort = dev; |
525 | struct ttystatics *tp; /* pointer to our ttystruct */ | 510 | struct ttystatics *tp; /* pointer to our ttystruct */ |
526 | #endif | 511 | #endif |
527 | struct Port *PortP = ptr; /* pointer to the port structure */ | 512 | struct Port *PortP = ptr; /* pointer to the port structure */ |
528 | int deleted = 0; | 513 | int deleted = 0; |
529 | int try = -1; /* Disable the timeouts by setting them to -1 */ | 514 | int try = -1; /* Disable the timeouts by setting them to -1 */ |
530 | int repeat_this = -1; /* Congrats to those having 15 years of | 515 | int repeat_this = -1; /* Congrats to those having 15 years of |
531 | uptime! (You get to break the driver.) */ | 516 | uptime! (You get to break the driver.) */ |
532 | unsigned long end_time; | 517 | unsigned long end_time; |
533 | struct tty_struct * tty; | 518 | struct tty_struct *tty; |
534 | unsigned long flags; | 519 | unsigned long flags; |
535 | int Modem; | 520 | int Modem; |
536 | int rv = 0; | 521 | int rv = 0; |
537 | 522 | ||
538 | rio_dprintk (RIO_DEBUG_TTY, "port close SysPort %d\n",PortP->PortNum); | 523 | rio_dprintk(RIO_DEBUG_TTY, "port close SysPort %d\n", PortP->PortNum); |
539 | 524 | ||
540 | /* PortP = p->RIOPortp[SysPort]; */ | 525 | /* PortP = p->RIOPortp[SysPort]; */ |
541 | rio_dprintk (RIO_DEBUG_TTY, "Port is at address 0x%x\n",(int)PortP); | 526 | rio_dprintk(RIO_DEBUG_TTY, "Port is at address 0x%x\n", (int) PortP); |
542 | /* tp = PortP->TtyP;*/ /* Get tty */ | 527 | /* tp = PortP->TtyP; *//* Get tty */ |
543 | tty = PortP->gs.tty; | 528 | tty = PortP->gs.tty; |
544 | rio_dprintk (RIO_DEBUG_TTY, "TTY is at address 0x%x\n",(int)tty); | 529 | rio_dprintk(RIO_DEBUG_TTY, "TTY is at address 0x%x\n", (int) tty); |
545 | 530 | ||
546 | if (PortP->gs.closing_wait) | 531 | if (PortP->gs.closing_wait) |
547 | end_time = jiffies + PortP->gs.closing_wait; | 532 | end_time = jiffies + PortP->gs.closing_wait; |
548 | else | 533 | else |
549 | end_time = jiffies + MAX_SCHEDULE_TIMEOUT; | 534 | end_time = jiffies + MAX_SCHEDULE_TIMEOUT; |
550 | 535 | ||
551 | Modem = rio_ismodem(tty); | 536 | Modem = rio_ismodem(tty); |
@@ -553,48 +538,48 @@ riotclose(void *ptr) | |||
553 | /* What F.CKING cache? Even then, a higly idle multiprocessor, | 538 | /* What F.CKING cache? Even then, a higly idle multiprocessor, |
554 | system with large caches this won't work . Better find out when | 539 | system with large caches this won't work . Better find out when |
555 | this doesn't work asap, and fix the cause. -- REW */ | 540 | this doesn't work asap, and fix the cause. -- REW */ |
556 | 541 | ||
557 | RIODelay(PortP, HUNDRED_MS*10); /* To flush the cache */ | 542 | RIODelay(PortP, HUNDRED_MS * 10); /* To flush the cache */ |
558 | #endif | 543 | #endif |
559 | rio_spin_lock_irqsave(&PortP->portSem, flags); | 544 | rio_spin_lock_irqsave(&PortP->portSem, flags); |
560 | 545 | ||
561 | /* | 546 | /* |
562 | ** Setting this flag will make any process trying to open | 547 | ** Setting this flag will make any process trying to open |
563 | ** this port block until we are complete closing it. | 548 | ** this port block until we are complete closing it. |
564 | */ | 549 | */ |
565 | PortP->State |= RIO_CLOSING; | 550 | PortP->State |= RIO_CLOSING; |
566 | 551 | ||
567 | if ( (PortP->State & RIO_DELETED) ) { | 552 | if ((PortP->State & RIO_DELETED)) { |
568 | rio_dprintk (RIO_DEBUG_TTY, "Close on deleted RTA\n"); | 553 | rio_dprintk(RIO_DEBUG_TTY, "Close on deleted RTA\n"); |
569 | deleted = 1; | 554 | deleted = 1; |
570 | } | 555 | } |
571 | 556 | ||
572 | if ( p->RIOHalted ) { | 557 | if (p->RIOHalted) { |
573 | RIOClearUp( PortP ); | 558 | RIOClearUp(PortP); |
574 | rv = -EIO; | 559 | rv = -EIO; |
575 | goto close_end; | 560 | goto close_end; |
576 | } | 561 | } |
577 | 562 | ||
578 | rio_dprintk (RIO_DEBUG_TTY, "Clear bits\n"); | 563 | rio_dprintk(RIO_DEBUG_TTY, "Clear bits\n"); |
579 | /* | 564 | /* |
580 | ** clear the open bits for this device | 565 | ** clear the open bits for this device |
581 | */ | 566 | */ |
582 | PortP->State &= (Modem ? ~RIO_MOPEN : ~RIO_LOPEN); | 567 | PortP->State &= (Modem ? ~RIO_MOPEN : ~RIO_LOPEN); |
583 | PortP->State &= ~RIO_CARR_ON; | 568 | PortP->State &= ~RIO_CARR_ON; |
584 | PortP->ModemState &= ~MSVR1_CD; | 569 | PortP->ModemState &= ~MSVR1_CD; |
585 | /* | 570 | /* |
586 | ** If the device was open as both a Modem and a tty line | 571 | ** If the device was open as both a Modem and a tty line |
587 | ** then we need to wimp out here, as the port has not really | 572 | ** then we need to wimp out here, as the port has not really |
588 | ** been finally closed (gee, whizz!) The test here uses the | 573 | ** been finally closed (gee, whizz!) The test here uses the |
589 | ** bit for the OTHER mode of operation, to see if THAT is | 574 | ** bit for the OTHER mode of operation, to see if THAT is |
590 | ** still active! | 575 | ** still active! |
591 | */ | 576 | */ |
592 | if ( (PortP->State & (RIO_LOPEN|RIO_MOPEN)) ) { | 577 | if ((PortP->State & (RIO_LOPEN | RIO_MOPEN))) { |
593 | /* | 578 | /* |
594 | ** The port is still open for the other task - | 579 | ** The port is still open for the other task - |
595 | ** return, pretending that we are still active. | 580 | ** return, pretending that we are still active. |
596 | */ | 581 | */ |
597 | rio_dprintk (RIO_DEBUG_TTY, "Channel %d still open !\n",PortP->PortNum); | 582 | rio_dprintk(RIO_DEBUG_TTY, "Channel %d still open !\n", PortP->PortNum); |
598 | PortP->State &= ~RIO_CLOSING; | 583 | PortP->State &= ~RIO_CLOSING; |
599 | if (PortP->firstOpen) | 584 | if (PortP->firstOpen) |
600 | PortP->firstOpen--; | 585 | PortP->firstOpen--; |
@@ -602,48 +587,47 @@ riotclose(void *ptr) | |||
602 | return -EIO; | 587 | return -EIO; |
603 | } | 588 | } |
604 | 589 | ||
605 | rio_dprintk (RIO_DEBUG_TTY, "Closing down - everything must go!\n"); | 590 | rio_dprintk(RIO_DEBUG_TTY, "Closing down - everything must go!\n"); |
606 | 591 | ||
607 | PortP->State &= ~RIO_DYNOROD; | 592 | PortP->State &= ~RIO_DYNOROD; |
608 | 593 | ||
609 | /* | 594 | /* |
610 | ** This is where we wait for the port | 595 | ** This is where we wait for the port |
611 | ** to drain down before closing. Bye-bye.... | 596 | ** to drain down before closing. Bye-bye.... |
612 | ** (We never meant to do this) | 597 | ** (We never meant to do this) |
613 | */ | 598 | */ |
614 | rio_dprintk (RIO_DEBUG_TTY, "Timeout 1 starts\n"); | 599 | rio_dprintk(RIO_DEBUG_TTY, "Timeout 1 starts\n"); |
615 | 600 | ||
616 | if (!deleted) | 601 | if (!deleted) |
617 | while ( (PortP->InUse != NOT_INUSE) && !p->RIOHalted && | 602 | while ((PortP->InUse != NOT_INUSE) && !p->RIOHalted && (PortP->TxBufferIn != PortP->TxBufferOut)) { |
618 | (PortP->TxBufferIn != PortP->TxBufferOut) ) { | 603 | cprintf("Need to flush the ttyport\n"); |
619 | cprintf("Need to flush the ttyport\n"); | 604 | if (repeat_this-- <= 0) { |
620 | if (repeat_this -- <= 0) { | 605 | rv = -EINTR; |
621 | rv = -EINTR; | 606 | rio_dprintk(RIO_DEBUG_TTY, "Waiting for not idle closed broken by signal\n"); |
622 | rio_dprintk (RIO_DEBUG_TTY, "Waiting for not idle closed broken by signal\n"); | 607 | RIOPreemptiveCmd(p, PortP, FCLOSE); |
623 | RIOPreemptiveCmd(p, PortP, FCLOSE); | 608 | goto close_end; |
624 | goto close_end; | 609 | } |
625 | } | 610 | rio_dprintk(RIO_DEBUG_TTY, "Calling timeout to flush in closing\n"); |
626 | rio_dprintk (RIO_DEBUG_TTY, "Calling timeout to flush in closing\n"); | 611 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); |
627 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | 612 | if (RIODelay_ni(PortP, HUNDRED_MS * 10) == RIO_FAIL) { |
628 | if (RIODelay_ni(PortP, HUNDRED_MS*10) == RIO_FAIL) { | 613 | rio_dprintk(RIO_DEBUG_TTY, "RTA EINTR in delay \n"); |
629 | rio_dprintk (RIO_DEBUG_TTY, "RTA EINTR in delay \n"); | 614 | rv = -EINTR; |
630 | rv = -EINTR; | 615 | rio_spin_lock_irqsave(&PortP->portSem, flags); |
616 | goto close_end; | ||
617 | } | ||
631 | rio_spin_lock_irqsave(&PortP->portSem, flags); | 618 | rio_spin_lock_irqsave(&PortP->portSem, flags); |
632 | goto close_end; | ||
633 | } | 619 | } |
634 | rio_spin_lock_irqsave(&PortP->portSem, flags); | ||
635 | } | ||
636 | 620 | ||
637 | PortP->TxBufferIn = PortP->TxBufferOut = 0; | 621 | PortP->TxBufferIn = PortP->TxBufferOut = 0; |
638 | repeat_this = 0xff; | 622 | repeat_this = 0xff; |
639 | 623 | ||
640 | PortP->InUse = 0; | 624 | PortP->InUse = 0; |
641 | if ( (PortP->State & (RIO_LOPEN|RIO_MOPEN)) ) { | 625 | if ((PortP->State & (RIO_LOPEN | RIO_MOPEN))) { |
642 | /* | 626 | /* |
643 | ** The port has been re-opened for the other task - | 627 | ** The port has been re-opened for the other task - |
644 | ** return, pretending that we are still active. | 628 | ** return, pretending that we are still active. |
645 | */ | 629 | */ |
646 | rio_dprintk (RIO_DEBUG_TTY, "Channel %d re-open!\n", PortP->PortNum); | 630 | rio_dprintk(RIO_DEBUG_TTY, "Channel %d re-open!\n", PortP->PortNum); |
647 | PortP->State &= ~RIO_CLOSING; | 631 | PortP->State &= ~RIO_CLOSING; |
648 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | 632 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); |
649 | if (PortP->firstOpen) | 633 | if (PortP->firstOpen) |
@@ -651,8 +635,8 @@ riotclose(void *ptr) | |||
651 | return -EIO; | 635 | return -EIO; |
652 | } | 636 | } |
653 | 637 | ||
654 | if ( p->RIOHalted ) { | 638 | if (p->RIOHalted) { |
655 | RIOClearUp( PortP ); | 639 | RIOClearUp(PortP); |
656 | goto close_end; | 640 | goto close_end; |
657 | } | 641 | } |
658 | 642 | ||
@@ -665,57 +649,56 @@ riotclose(void *ptr) | |||
665 | } | 649 | } |
666 | 650 | ||
667 | if (!deleted) | 651 | if (!deleted) |
668 | while (try && (PortP->PortState & PORT_ISOPEN)) { | 652 | while (try && (PortP->PortState & PORT_ISOPEN)) { |
669 | try--; | 653 | try--; |
670 | if (time_after (jiffies, end_time)) { | 654 | if (time_after(jiffies, end_time)) { |
671 | rio_dprintk (RIO_DEBUG_TTY, "Run out of tries - force the bugger shut!\n" ); | 655 | rio_dprintk(RIO_DEBUG_TTY, "Run out of tries - force the bugger shut!\n"); |
672 | RIOPreemptiveCmd(p, PortP,FCLOSE); | 656 | RIOPreemptiveCmd(p, PortP, FCLOSE); |
673 | break; | 657 | break; |
674 | } | 658 | } |
675 | rio_dprintk (RIO_DEBUG_TTY, "Close: PortState:ISOPEN is %d\n", | 659 | rio_dprintk(RIO_DEBUG_TTY, "Close: PortState:ISOPEN is %d\n", PortP->PortState & PORT_ISOPEN); |
676 | PortP->PortState & PORT_ISOPEN); | ||
677 | 660 | ||
678 | if ( p->RIOHalted ) { | 661 | if (p->RIOHalted) { |
679 | RIOClearUp( PortP ); | 662 | RIOClearUp(PortP); |
680 | goto close_end; | 663 | goto close_end; |
681 | } | 664 | } |
682 | if (RIODelay(PortP, HUNDRED_MS) == RIO_FAIL) { | 665 | if (RIODelay(PortP, HUNDRED_MS) == RIO_FAIL) { |
683 | rio_dprintk (RIO_DEBUG_TTY, "RTA EINTR in delay \n"); | 666 | rio_dprintk(RIO_DEBUG_TTY, "RTA EINTR in delay \n"); |
684 | RIOPreemptiveCmd(p, PortP,FCLOSE); | 667 | RIOPreemptiveCmd(p, PortP, FCLOSE); |
685 | break; | 668 | break; |
669 | } | ||
686 | } | 670 | } |
687 | } | ||
688 | rio_spin_lock_irqsave(&PortP->portSem, flags); | 671 | rio_spin_lock_irqsave(&PortP->portSem, flags); |
689 | rio_dprintk (RIO_DEBUG_TTY, "Close: try was %d on completion\n", try ); | 672 | rio_dprintk(RIO_DEBUG_TTY, "Close: try was %d on completion\n", try); |
690 | 673 | ||
691 | /* RIOPreemptiveCmd(p, PortP, FCLOSE); */ | 674 | /* RIOPreemptiveCmd(p, PortP, FCLOSE); */ |
692 | 675 | ||
693 | /* | 676 | /* |
694 | ** 15.10.1998 ARG - ESIL 0761 part fix | 677 | ** 15.10.1998 ARG - ESIL 0761 part fix |
695 | ** 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. | 678 | ** 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. |
696 | */ | 679 | */ |
697 | PortP->Config &= ~(RIO_CTSFLOW|RIO_RTSFLOW); | 680 | PortP->Config &= ~(RIO_CTSFLOW | RIO_RTSFLOW); |
698 | 681 | ||
699 | #ifdef STATS | 682 | #ifdef STATS |
700 | PortP->Stat.CloseCnt++; | 683 | PortP->Stat.CloseCnt++; |
701 | #endif | 684 | #endif |
702 | /* | 685 | /* |
703 | ** Count opens for port statistics reporting | 686 | ** Count opens for port statistics reporting |
704 | */ | 687 | */ |
705 | if (PortP->statsGather) | 688 | if (PortP->statsGather) |
706 | PortP->closes++; | 689 | PortP->closes++; |
707 | 690 | ||
708 | close_end: | 691 | close_end: |
709 | /* XXX: Why would a "DELETED" flag be reset here? I'd have | 692 | /* XXX: Why would a "DELETED" flag be reset here? I'd have |
710 | thought that a "deleted" flag means that the port was | 693 | thought that a "deleted" flag means that the port was |
711 | permanently gone, but here we can make it reappear by it | 694 | permanently gone, but here we can make it reappear by it |
712 | being in close during the "deletion". | 695 | being in close during the "deletion". |
713 | */ | 696 | */ |
714 | PortP->State &= ~(RIO_CLOSING|RIO_DELETED); | 697 | PortP->State &= ~(RIO_CLOSING | RIO_DELETED); |
715 | if (PortP->firstOpen) | 698 | if (PortP->firstOpen) |
716 | PortP->firstOpen--; | 699 | PortP->firstOpen--; |
717 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | 700 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); |
718 | rio_dprintk (RIO_DEBUG_TTY, "Return from close\n"); | 701 | rio_dprintk(RIO_DEBUG_TTY, "Return from close\n"); |
719 | return rv; | 702 | return rv; |
720 | } | 703 | } |
721 | 704 | ||
@@ -728,52 +711,50 @@ close_end: | |||
728 | ** COOK_MEDIUM if the card can do all the processing necessary. | 711 | ** COOK_MEDIUM if the card can do all the processing necessary. |
729 | */ | 712 | */ |
730 | #if 0 | 713 | #if 0 |
731 | static int | 714 | static int RIOCookMode(struct ttystatics *tp) |
732 | RIOCookMode(struct ttystatics *tp) | ||
733 | { | 715 | { |
734 | /* | 716 | /* |
735 | ** We can't handle tm.c_mstate != 0 on SCO | 717 | ** We can't handle tm.c_mstate != 0 on SCO |
736 | ** We can't handle mapping | 718 | ** We can't handle mapping |
737 | ** We can't handle non-ttwrite line disc. | 719 | ** We can't handle non-ttwrite line disc. |
738 | ** We can't handle lflag XCASE | 720 | ** We can't handle lflag XCASE |
739 | ** We can handle oflag OPOST & (OCRNL, ONLCR, TAB3) | 721 | ** We can handle oflag OPOST & (OCRNL, ONLCR, TAB3) |
740 | */ | 722 | */ |
741 | 723 | ||
742 | #ifdef CHECK | 724 | #ifdef CHECK |
743 | CheckTtyP( tp ); | 725 | CheckTtyP(tp); |
744 | #endif | 726 | #endif |
745 | if (!(tp->tm.c_oflag & OPOST)) /* No post processing */ | 727 | if (!(tp->tm.c_oflag & OPOST)) /* No post processing */ |
746 | return COOK_RAW; /* Raw mode o/p */ | 728 | return COOK_RAW; /* Raw mode o/p */ |
747 | 729 | ||
748 | if ( tp->tm.c_lflag & XCASE ) | 730 | if (tp->tm.c_lflag & XCASE) |
749 | return COOK_WELL; /* Use line disc */ | 731 | return COOK_WELL; /* Use line disc */ |
750 | 732 | ||
751 | if (tp->tm.c_oflag & ~(OPOST | ONLCR | OCRNL | TAB3 ) ) | 733 | if (tp->tm.c_oflag & ~(OPOST | ONLCR | OCRNL | TAB3)) |
752 | return COOK_WELL; /* Use line disc for strange modes */ | 734 | return COOK_WELL; /* Use line disc for strange modes */ |
753 | 735 | ||
754 | if ( tp->tm.c_oflag == OPOST ) /* If only OPOST is set, do RAW */ | 736 | if (tp->tm.c_oflag == OPOST) /* If only OPOST is set, do RAW */ |
755 | return COOK_RAW; | 737 | return COOK_RAW; |
756 | 738 | ||
757 | /* | 739 | /* |
758 | ** So, we need to output process! | 740 | ** So, we need to output process! |
759 | */ | 741 | */ |
760 | return COOK_MEDIUM; | 742 | return COOK_MEDIUM; |
761 | } | 743 | } |
762 | #endif | 744 | #endif |
763 | 745 | ||
764 | static void | 746 | static void RIOClearUp(PortP) |
765 | RIOClearUp(PortP) | ||
766 | struct Port *PortP; | 747 | struct Port *PortP; |
767 | { | 748 | { |
768 | rio_dprintk (RIO_DEBUG_TTY, "RIOHalted set\n"); | 749 | rio_dprintk(RIO_DEBUG_TTY, "RIOHalted set\n"); |
769 | PortP->Config = 0; /* Direct semaphore */ | 750 | PortP->Config = 0; /* Direct semaphore */ |
770 | PortP->PortState = 0; | 751 | PortP->PortState = 0; |
771 | PortP->firstOpen = 0; | 752 | PortP->firstOpen = 0; |
772 | PortP->FlushCmdBodge = 0; | 753 | PortP->FlushCmdBodge = 0; |
773 | PortP->ModemState = PortP->CookMode = 0; | 754 | PortP->ModemState = PortP->CookMode = 0; |
774 | PortP->Mapped = 0; | 755 | PortP->Mapped = 0; |
775 | PortP->WflushFlag = 0; | 756 | PortP->WflushFlag = 0; |
776 | PortP->MagicFlags = 0; | 757 | PortP->MagicFlags = 0; |
777 | PortP->RxDataStart = 0; | 758 | PortP->RxDataStart = 0; |
778 | PortP->TxBufferIn = 0; | 759 | PortP->TxBufferIn = 0; |
779 | PortP->TxBufferOut = 0; | 760 | PortP->TxBufferOut = 0; |
@@ -788,33 +769,31 @@ struct Port *PortP; | |||
788 | ** Other values of len aren't allowed, and will cause | 769 | ** Other values of len aren't allowed, and will cause |
789 | ** a panic. | 770 | ** a panic. |
790 | */ | 771 | */ |
791 | int RIOShortCommand(struct rio_info *p, struct Port *PortP, | 772 | int RIOShortCommand(struct rio_info *p, struct Port *PortP, int command, int len, int arg) |
792 | int command, int len, int arg) | ||
793 | { | 773 | { |
794 | PKT *PacketP; | 774 | PKT *PacketP; |
795 | int retries = 20; /* at 10 per second -> 2 seconds */ | 775 | int retries = 20; /* at 10 per second -> 2 seconds */ |
796 | unsigned long flags; | 776 | unsigned long flags; |
797 | 777 | ||
798 | rio_dprintk (RIO_DEBUG_TTY, "entering shortcommand.\n"); | 778 | rio_dprintk(RIO_DEBUG_TTY, "entering shortcommand.\n"); |
799 | #ifdef CHECK | 779 | #ifdef CHECK |
800 | CheckPortP( PortP ); | 780 | CheckPortP(PortP); |
801 | if ( len < 1 || len > 2 ) | 781 | if (len < 1 || len > 2) |
802 | cprintf(("STUPID LENGTH %d\n",len)); | 782 | cprintf(("STUPID LENGTH %d\n", len)); |
803 | #endif | 783 | #endif |
804 | 784 | ||
805 | if ( PortP->State & RIO_DELETED ) { | 785 | if (PortP->State & RIO_DELETED) { |
806 | rio_dprintk (RIO_DEBUG_TTY, "Short command to deleted RTA ignored\n"); | 786 | rio_dprintk(RIO_DEBUG_TTY, "Short command to deleted RTA ignored\n"); |
807 | return RIO_FAIL; | 787 | return RIO_FAIL; |
808 | } | 788 | } |
809 | rio_spin_lock_irqsave(&PortP->portSem, flags); | 789 | rio_spin_lock_irqsave(&PortP->portSem, flags); |
810 | 790 | ||
811 | /* | 791 | /* |
812 | ** If the port is in use for pre-emptive command, then wait for it to | 792 | ** If the port is in use for pre-emptive command, then wait for it to |
813 | ** be free again. | 793 | ** be free again. |
814 | */ | 794 | */ |
815 | while ( (PortP->InUse != NOT_INUSE) && !p->RIOHalted ) { | 795 | while ((PortP->InUse != NOT_INUSE) && !p->RIOHalted) { |
816 | rio_dprintk (RIO_DEBUG_TTY, "Waiting for not in use (%d)\n", | 796 | rio_dprintk(RIO_DEBUG_TTY, "Waiting for not in use (%d)\n", retries); |
817 | retries); | ||
818 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | 797 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); |
819 | if (retries-- <= 0) { | 798 | if (retries-- <= 0) { |
820 | return RIO_FAIL; | 799 | return RIO_FAIL; |
@@ -824,47 +803,47 @@ int RIOShortCommand(struct rio_info *p, struct Port *PortP, | |||
824 | } | 803 | } |
825 | rio_spin_lock_irqsave(&PortP->portSem, flags); | 804 | rio_spin_lock_irqsave(&PortP->portSem, flags); |
826 | } | 805 | } |
827 | if ( PortP->State & RIO_DELETED ) { | 806 | if (PortP->State & RIO_DELETED) { |
828 | rio_dprintk (RIO_DEBUG_TTY, "Short command to deleted RTA ignored\n"); | 807 | rio_dprintk(RIO_DEBUG_TTY, "Short command to deleted RTA ignored\n"); |
829 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | 808 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); |
830 | return RIO_FAIL; | 809 | return RIO_FAIL; |
831 | } | 810 | } |
832 | 811 | ||
833 | while ( !can_add_transmit(&PacketP,PortP) && !p->RIOHalted ) { | 812 | while (!can_add_transmit(&PacketP, PortP) && !p->RIOHalted) { |
834 | rio_dprintk (RIO_DEBUG_TTY, "Waiting to add short command to queue (%d)\n", retries); | 813 | rio_dprintk(RIO_DEBUG_TTY, "Waiting to add short command to queue (%d)\n", retries); |
835 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | 814 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); |
836 | if (retries-- <= 0) { | 815 | if (retries-- <= 0) { |
837 | rio_dprintk (RIO_DEBUG_TTY, "out of tries. Failing\n"); | 816 | rio_dprintk(RIO_DEBUG_TTY, "out of tries. Failing\n"); |
838 | return RIO_FAIL; | 817 | return RIO_FAIL; |
839 | } | 818 | } |
840 | if ( RIODelay_ni(PortP, HUNDRED_MS)==RIO_FAIL ) { | 819 | if (RIODelay_ni(PortP, HUNDRED_MS) == RIO_FAIL) { |
841 | return RIO_FAIL; | 820 | return RIO_FAIL; |
842 | } | 821 | } |
843 | rio_spin_lock_irqsave(&PortP->portSem, flags); | 822 | rio_spin_lock_irqsave(&PortP->portSem, flags); |
844 | } | 823 | } |
845 | 824 | ||
846 | if ( p->RIOHalted ) { | 825 | if (p->RIOHalted) { |
847 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | 826 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); |
848 | return RIO_FAIL; | 827 | return RIO_FAIL; |
849 | } | 828 | } |
850 | 829 | ||
851 | /* | 830 | /* |
852 | ** set the command byte and the argument byte | 831 | ** set the command byte and the argument byte |
853 | */ | 832 | */ |
854 | WBYTE(PacketP->data[0] , command); | 833 | WBYTE(PacketP->data[0], command); |
855 | 834 | ||
856 | if ( len==2 ) | 835 | if (len == 2) |
857 | WBYTE(PacketP->data[1] , arg); | 836 | WBYTE(PacketP->data[1], arg); |
858 | 837 | ||
859 | /* | 838 | /* |
860 | ** set the length of the packet and set the command bit. | 839 | ** set the length of the packet and set the command bit. |
861 | */ | 840 | */ |
862 | WBYTE(PacketP->len , PKT_CMD_BIT | len); | 841 | WBYTE(PacketP->len, PKT_CMD_BIT | len); |
863 | 842 | ||
864 | add_transmit(PortP); | 843 | add_transmit(PortP); |
865 | /* | 844 | /* |
866 | ** Count characters transmitted for port statistics reporting | 845 | ** Count characters transmitted for port statistics reporting |
867 | */ | 846 | */ |
868 | if (PortP->statsGather) | 847 | if (PortP->statsGather) |
869 | PortP->txchars += len; | 848 | PortP->txchars += len; |
870 | 849 | ||
@@ -878,28 +857,26 @@ int RIOShortCommand(struct rio_info *p, struct Port *PortP, | |||
878 | ** This is an ioctl interface. This is the twentieth century. You know what | 857 | ** This is an ioctl interface. This is the twentieth century. You know what |
879 | ** its all about. | 858 | ** its all about. |
880 | */ | 859 | */ |
881 | int | 860 | int riotioctl(struct rio_info *p, struct tty_struct *tty, int cmd, caddr_t arg) |
882 | riotioctl(struct rio_info *p, struct tty_struct *tty, int cmd, caddr_t arg) | ||
883 | { | 861 | { |
884 | register struct Port *PortP; | 862 | register struct Port *PortP; |
885 | register struct ttystatics *tp; | 863 | register struct ttystatics *tp; |
886 | int current; | 864 | int current; |
887 | int ParamSemIncremented = 0; | 865 | int ParamSemIncremented = 0; |
888 | int old_oflag, old_cflag, old_iflag, changed, oldcook; | 866 | int old_oflag, old_cflag, old_iflag, changed, oldcook; |
889 | int i; | 867 | int i; |
890 | unsigned char sio_regs[5]; /* Here be magic */ | 868 | unsigned char sio_regs[5]; /* Here be magic */ |
891 | short vpix_cflag; | 869 | short vpix_cflag; |
892 | short divisor; | 870 | short divisor; |
893 | int baud; | 871 | int baud; |
894 | uint SysPort = rio_minor(tty); | 872 | uint SysPort = rio_minor(tty); |
895 | int Modem = rio_ismodem(tty); | 873 | int Modem = rio_ismodem(tty); |
896 | int ioctl_processed; | 874 | int ioctl_processed; |
897 | 875 | ||
898 | rio_dprintk (RIO_DEBUG_TTY, "port ioctl SysPort %d command 0x%x argument 0x%x %s\n", | 876 | rio_dprintk(RIO_DEBUG_TTY, "port ioctl SysPort %d command 0x%x argument 0x%x %s\n", SysPort, cmd, arg, Modem ? "Modem" : "tty"); |
899 | SysPort, cmd, arg, Modem?"Modem":"tty") ; | 877 | |
900 | 878 | if (SysPort >= RIO_PORTS) { | |
901 | if ( SysPort >= RIO_PORTS ) { | 879 | rio_dprintk(RIO_DEBUG_TTY, "Bad port number %d\n", SysPort); |
902 | rio_dprintk (RIO_DEBUG_TTY, "Bad port number %d\n", SysPort); | ||
903 | return -ENXIO; | 880 | return -ENXIO; |
904 | } | 881 | } |
905 | 882 | ||
@@ -912,205 +889,195 @@ riotioctl(struct rio_info *p, struct tty_struct *tty, int cmd, caddr_t arg) | |||
912 | PortP->Stat.IoctlCnt++; | 889 | PortP->Stat.IoctlCnt++; |
913 | #endif | 890 | #endif |
914 | 891 | ||
915 | if ( PortP->State & RIO_DELETED ) { | 892 | if (PortP->State & RIO_DELETED) { |
916 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | 893 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); |
917 | return -EIO; | 894 | return -EIO; |
918 | } | 895 | } |
919 | 896 | ||
920 | 897 | ||
921 | if ( p->RIOHalted ) { | 898 | if (p->RIOHalted) { |
922 | RIOClearUp( PortP ); | 899 | RIOClearUp(PortP); |
923 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | 900 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); |
924 | return -EIO; | 901 | return -EIO; |
925 | } | 902 | } |
926 | 903 | ||
927 | /* | 904 | /* |
928 | ** Count ioctls for port statistics reporting | 905 | ** Count ioctls for port statistics reporting |
929 | */ | 906 | */ |
930 | if (PortP->statsGather) | 907 | if (PortP->statsGather) |
931 | PortP->ioctls++; | 908 | PortP->ioctls++; |
932 | 909 | ||
933 | /* | 910 | /* |
934 | ** Specialix RIO Ioctl calls | 911 | ** Specialix RIO Ioctl calls |
935 | */ | 912 | */ |
936 | switch (cmd) { | 913 | switch (cmd) { |
937 | 914 | ||
938 | case TCRIOTRIAD: | 915 | case TCRIOTRIAD: |
939 | if ( arg ) | 916 | if (arg) |
940 | PortP->State |= RIO_TRIAD_MODE; | 917 | PortP->State |= RIO_TRIAD_MODE; |
941 | else | 918 | else |
942 | PortP->State &= ~RIO_TRIAD_MODE; | 919 | PortP->State &= ~RIO_TRIAD_MODE; |
943 | /* | 920 | /* |
944 | ** Normally, when istrip is set on a port, a config is | 921 | ** Normally, when istrip is set on a port, a config is |
945 | ** sent to the RTA instructing the CD1400 to do the | 922 | ** sent to the RTA instructing the CD1400 to do the |
946 | ** stripping. In TRIAD mode, the interrupt receive routine | 923 | ** stripping. In TRIAD mode, the interrupt receive routine |
947 | ** must do the stripping instead, since it has to detect | 924 | ** must do the stripping instead, since it has to detect |
948 | ** an 8 bit function key sequence. If istrip is set with | 925 | ** an 8 bit function key sequence. If istrip is set with |
949 | ** TRIAD mode on(off), and 8 bit data is being read by | 926 | ** TRIAD mode on(off), and 8 bit data is being read by |
950 | ** the port, the user then turns TRIAD mode off(on), the RTA | 927 | ** the port, the user then turns TRIAD mode off(on), the RTA |
951 | ** must be reconfigured (not) to do the stripping. | 928 | ** must be reconfigured (not) to do the stripping. |
952 | ** Hence we call RIOParam here. | 929 | ** Hence we call RIOParam here. |
953 | */ | 930 | */ |
954 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | 931 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); |
955 | RIOParam(PortP,CONFIG,Modem,OK_TO_SLEEP); | 932 | RIOParam(PortP, CONFIG, Modem, OK_TO_SLEEP); |
956 | return 0; | 933 | return 0; |
957 | 934 | ||
958 | case TCRIOTSTATE: | 935 | case TCRIOTSTATE: |
959 | rio_dprintk (RIO_DEBUG_TTY, "tbusy/tstop monitoring %sabled\n", | 936 | rio_dprintk(RIO_DEBUG_TTY, "tbusy/tstop monitoring %sabled\n", arg ? "en" : "dis"); |
960 | arg ? "en" : "dis"); | 937 | /* MonitorTstate = 0 ; */ |
961 | /* MonitorTstate = 0 ;*/ | 938 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); |
962 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | 939 | RIOParam(PortP, CONFIG, Modem, OK_TO_SLEEP); |
963 | RIOParam(PortP, CONFIG, Modem, OK_TO_SLEEP); | 940 | return 0; |
964 | return 0; | ||
965 | 941 | ||
966 | case TCRIOSTATE: /* current state of Modem input pins */ | 942 | case TCRIOSTATE: /* current state of Modem input pins */ |
967 | rio_dprintk (RIO_DEBUG_TTY, "TCRIOSTATE\n"); | 943 | rio_dprintk(RIO_DEBUG_TTY, "TCRIOSTATE\n"); |
968 | if (RIOPreemptiveCmd(p, PortP, MGET) == RIO_FAIL) | 944 | if (RIOPreemptiveCmd(p, PortP, MGET) == RIO_FAIL) |
969 | rio_dprintk (RIO_DEBUG_TTY, "TCRIOSTATE command failed\n"); | 945 | rio_dprintk(RIO_DEBUG_TTY, "TCRIOSTATE command failed\n"); |
970 | PortP->State |= RIO_BUSY; | 946 | PortP->State |= RIO_BUSY; |
971 | current = PortP->ModemState; | 947 | current = PortP->ModemState; |
972 | if ( copyout((caddr_t)¤t, (int)arg, | 948 | if (copyout((caddr_t) & current, (int) arg, sizeof(current)) == COPYFAIL) { |
973 | sizeof(current))==COPYFAIL ) { | 949 | rio_dprintk(RIO_DEBUG_TTY, "Copyout failed\n"); |
974 | rio_dprintk (RIO_DEBUG_TTY, "Copyout failed\n"); | ||
975 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | ||
976 | pseterr(EFAULT); | ||
977 | } | ||
978 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | 950 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); |
979 | return 0; | 951 | pseterr(EFAULT); |
952 | } | ||
953 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | ||
954 | return 0; | ||
980 | 955 | ||
981 | case TCRIOMBIS: /* Set modem lines */ | 956 | case TCRIOMBIS: /* Set modem lines */ |
982 | case TCRIOMBIC: /* Clear modem lines */ | 957 | case TCRIOMBIC: /* Clear modem lines */ |
983 | rio_dprintk (RIO_DEBUG_TTY, "TCRIOMBIS/TCRIOMBIC\n"); | 958 | rio_dprintk(RIO_DEBUG_TTY, "TCRIOMBIS/TCRIOMBIC\n"); |
984 | if (cmd == TCRIOMBIS) { | 959 | if (cmd == TCRIOMBIS) { |
985 | uint state; | 960 | uint state; |
986 | state = (uint)arg; | 961 | state = (uint) arg; |
987 | PortP->ModemState |= (ushort)state; | 962 | PortP->ModemState |= (ushort) state; |
988 | PortP->ModemLines = (ulong) arg; | 963 | PortP->ModemLines = (ulong) arg; |
989 | if (RIOPreemptiveCmd(p, PortP, MBIS) == RIO_FAIL) | 964 | if (RIOPreemptiveCmd(p, PortP, MBIS) == RIO_FAIL) |
990 | rio_dprintk (RIO_DEBUG_TTY, | 965 | rio_dprintk(RIO_DEBUG_TTY, "TCRIOMBIS command failed\n"); |
991 | "TCRIOMBIS command failed\n"); | 966 | } else { |
992 | } | 967 | uint state; |
993 | else { | ||
994 | uint state; | ||
995 | |||
996 | state = (uint)arg; | ||
997 | PortP->ModemState &= ~(ushort)state; | ||
998 | PortP->ModemLines = (ulong) arg; | ||
999 | if (RIOPreemptiveCmd(p, PortP, MBIC) == RIO_FAIL) | ||
1000 | rio_dprintk (RIO_DEBUG_TTY, "TCRIOMBIC command failed\n"); | ||
1001 | } | ||
1002 | PortP->State |= RIO_BUSY; | ||
1003 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | ||
1004 | return 0; | ||
1005 | 968 | ||
1006 | case TCRIOXPON: /* set Xprint ON string */ | 969 | state = (uint) arg; |
1007 | rio_dprintk (RIO_DEBUG_TTY, "TCRIOXPON\n"); | 970 | PortP->ModemState &= ~(ushort) state; |
1008 | if ( copyin((int)arg, (caddr_t)PortP->Xprint.XpOn, | 971 | PortP->ModemLines = (ulong) arg; |
1009 | MAX_XP_CTRL_LEN)==COPYFAIL ) { | 972 | if (RIOPreemptiveCmd(p, PortP, MBIC) == RIO_FAIL) |
1010 | rio_dprintk (RIO_DEBUG_TTY, "Copyin failed\n"); | 973 | rio_dprintk(RIO_DEBUG_TTY, "TCRIOMBIC command failed\n"); |
1011 | PortP->Xprint.XpOn[0] = '\0'; | 974 | } |
1012 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | 975 | PortP->State |= RIO_BUSY; |
1013 | pseterr(EFAULT); | 976 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); |
1014 | } | 977 | return 0; |
1015 | PortP->Xprint.XpOn[MAX_XP_CTRL_LEN-1] = '\0'; | ||
1016 | PortP->Xprint.XpLen = strlen(PortP->Xprint.XpOn)+ | ||
1017 | strlen(PortP->Xprint.XpOff); | ||
1018 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | ||
1019 | return 0; | ||
1020 | 978 | ||
1021 | case TCRIOXPOFF: /* set Xprint OFF string */ | 979 | case TCRIOXPON: /* set Xprint ON string */ |
1022 | rio_dprintk (RIO_DEBUG_TTY, "TCRIOXPOFF\n"); | 980 | rio_dprintk(RIO_DEBUG_TTY, "TCRIOXPON\n"); |
1023 | if ( copyin( (int)arg, (caddr_t)PortP->Xprint.XpOff, | 981 | if (copyin((int) arg, (caddr_t) PortP->Xprint.XpOn, MAX_XP_CTRL_LEN) == COPYFAIL) { |
1024 | MAX_XP_CTRL_LEN)==COPYFAIL ) { | 982 | rio_dprintk(RIO_DEBUG_TTY, "Copyin failed\n"); |
1025 | rio_dprintk (RIO_DEBUG_TTY, "Copyin failed\n"); | 983 | PortP->Xprint.XpOn[0] = '\0'; |
1026 | PortP->Xprint.XpOff[0] = '\0'; | ||
1027 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | ||
1028 | pseterr(EFAULT); | ||
1029 | } | ||
1030 | PortP->Xprint.XpOff[MAX_XP_CTRL_LEN-1] = '\0'; | ||
1031 | PortP->Xprint.XpLen = strlen(PortP->Xprint.XpOn)+ | ||
1032 | strlen(PortP->Xprint.XpOff); | ||
1033 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | 984 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); |
1034 | return 0; | 985 | pseterr(EFAULT); |
986 | } | ||
987 | PortP->Xprint.XpOn[MAX_XP_CTRL_LEN - 1] = '\0'; | ||
988 | PortP->Xprint.XpLen = strlen(PortP->Xprint.XpOn) + strlen(PortP->Xprint.XpOff); | ||
989 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | ||
990 | return 0; | ||
1035 | 991 | ||
1036 | case TCRIOXPCPS: /* set Xprint CPS string */ | 992 | case TCRIOXPOFF: /* set Xprint OFF string */ |
1037 | rio_dprintk (RIO_DEBUG_TTY, "TCRIOXPCPS\n"); | 993 | rio_dprintk(RIO_DEBUG_TTY, "TCRIOXPOFF\n"); |
1038 | if ( (uint)arg > p->RIOConf.MaxXpCps || | 994 | if (copyin((int) arg, (caddr_t) PortP->Xprint.XpOff, MAX_XP_CTRL_LEN) == COPYFAIL) { |
1039 | (uint)arg < p->RIOConf.MinXpCps ) { | 995 | rio_dprintk(RIO_DEBUG_TTY, "Copyin failed\n"); |
1040 | rio_dprintk (RIO_DEBUG_TTY, "%d CPS out of range\n",arg); | 996 | PortP->Xprint.XpOff[0] = '\0'; |
1041 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | ||
1042 | pseterr(EINVAL); | ||
1043 | return 0; | ||
1044 | } | ||
1045 | PortP->Xprint.XpCps = (uint)arg; | ||
1046 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | 997 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); |
1047 | return 0; | 998 | pseterr(EFAULT); |
999 | } | ||
1000 | PortP->Xprint.XpOff[MAX_XP_CTRL_LEN - 1] = '\0'; | ||
1001 | PortP->Xprint.XpLen = strlen(PortP->Xprint.XpOn) + strlen(PortP->Xprint.XpOff); | ||
1002 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | ||
1003 | return 0; | ||
1048 | 1004 | ||
1049 | case TCRIOXPRINT: | 1005 | case TCRIOXPCPS: /* set Xprint CPS string */ |
1050 | rio_dprintk (RIO_DEBUG_TTY, "TCRIOXPRINT\n"); | 1006 | rio_dprintk(RIO_DEBUG_TTY, "TCRIOXPCPS\n"); |
1051 | if ( copyout((caddr_t)&PortP->Xprint, (int)arg, | 1007 | if ((uint) arg > p->RIOConf.MaxXpCps || (uint) arg < p->RIOConf.MinXpCps) { |
1052 | sizeof(struct Xprint))==COPYFAIL ) { | 1008 | rio_dprintk(RIO_DEBUG_TTY, "%d CPS out of range\n", arg); |
1053 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | ||
1054 | pseterr(EFAULT); | ||
1055 | } | ||
1056 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | 1009 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); |
1010 | pseterr(EINVAL); | ||
1057 | return 0; | 1011 | return 0; |
1012 | } | ||
1013 | PortP->Xprint.XpCps = (uint) arg; | ||
1014 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | ||
1015 | return 0; | ||
1058 | 1016 | ||
1059 | case TCRIOIXANYON: | 1017 | case TCRIOXPRINT: |
1060 | rio_dprintk (RIO_DEBUG_TTY, "TCRIOIXANYON\n"); | 1018 | rio_dprintk(RIO_DEBUG_TTY, "TCRIOXPRINT\n"); |
1061 | PortP->Config |= RIO_IXANY; | 1019 | if (copyout((caddr_t) & PortP->Xprint, (int) arg, sizeof(struct Xprint)) == COPYFAIL) { |
1062 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | 1020 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); |
1063 | return 0; | 1021 | pseterr(EFAULT); |
1022 | } | ||
1023 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | ||
1024 | return 0; | ||
1064 | 1025 | ||
1065 | case TCRIOIXANYOFF: | 1026 | case TCRIOIXANYON: |
1066 | rio_dprintk (RIO_DEBUG_TTY, "TCRIOIXANYOFF\n"); | 1027 | rio_dprintk(RIO_DEBUG_TTY, "TCRIOIXANYON\n"); |
1067 | PortP->Config &= ~RIO_IXANY; | 1028 | PortP->Config |= RIO_IXANY; |
1068 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | 1029 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); |
1069 | return 0; | 1030 | return 0; |
1070 | 1031 | ||
1071 | case TCRIOIXONON: | 1032 | case TCRIOIXANYOFF: |
1072 | rio_dprintk (RIO_DEBUG_TTY, "TCRIOIXONON\n"); | 1033 | rio_dprintk(RIO_DEBUG_TTY, "TCRIOIXANYOFF\n"); |
1073 | PortP->Config |= RIO_IXON; | 1034 | PortP->Config &= ~RIO_IXANY; |
1074 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | 1035 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); |
1075 | return 0; | 1036 | return 0; |
1076 | 1037 | ||
1077 | case TCRIOIXONOFF: | 1038 | case TCRIOIXONON: |
1078 | rio_dprintk (RIO_DEBUG_TTY, "TCRIOIXONOFF\n"); | 1039 | rio_dprintk(RIO_DEBUG_TTY, "TCRIOIXONON\n"); |
1079 | PortP->Config &= ~RIO_IXON; | 1040 | PortP->Config |= RIO_IXON; |
1080 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | 1041 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); |
1081 | return 0; | 1042 | return 0; |
1043 | |||
1044 | case TCRIOIXONOFF: | ||
1045 | rio_dprintk(RIO_DEBUG_TTY, "TCRIOIXONOFF\n"); | ||
1046 | PortP->Config &= ~RIO_IXON; | ||
1047 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | ||
1048 | return 0; | ||
1082 | 1049 | ||
1083 | /* | 1050 | /* |
1084 | ** 15.10.1998 ARG - ESIL 0761 part fix | 1051 | ** 15.10.1998 ARG - ESIL 0761 part fix |
1085 | ** Added support for CTS and RTS flow control ioctls : | 1052 | ** Added support for CTS and RTS flow control ioctls : |
1086 | */ | 1053 | */ |
1087 | case TCRIOCTSFLOWEN: | 1054 | case TCRIOCTSFLOWEN: |
1088 | rio_dprintk (RIO_DEBUG_TTY, "TCRIOCTSFLOWEN\n"); | 1055 | rio_dprintk(RIO_DEBUG_TTY, "TCRIOCTSFLOWEN\n"); |
1089 | PortP->Config |= RIO_CTSFLOW; | 1056 | PortP->Config |= RIO_CTSFLOW; |
1090 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | 1057 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); |
1091 | RIOParam(PortP,CONFIG,Modem,OK_TO_SLEEP); | 1058 | RIOParam(PortP, CONFIG, Modem, OK_TO_SLEEP); |
1092 | return 0; | 1059 | return 0; |
1093 | 1060 | ||
1094 | case TCRIOCTSFLOWDIS: | 1061 | case TCRIOCTSFLOWDIS: |
1095 | rio_dprintk (RIO_DEBUG_TTY, "TCRIOCTSFLOWDIS\n"); | 1062 | rio_dprintk(RIO_DEBUG_TTY, "TCRIOCTSFLOWDIS\n"); |
1096 | PortP->Config &= ~RIO_CTSFLOW; | 1063 | PortP->Config &= ~RIO_CTSFLOW; |
1097 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | 1064 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); |
1098 | RIOParam(PortP,CONFIG,Modem,OK_TO_SLEEP); | 1065 | RIOParam(PortP, CONFIG, Modem, OK_TO_SLEEP); |
1099 | return 0; | 1066 | return 0; |
1100 | 1067 | ||
1101 | case TCRIORTSFLOWEN: | 1068 | case TCRIORTSFLOWEN: |
1102 | rio_dprintk (RIO_DEBUG_TTY, "TCRIORTSFLOWEN\n"); | 1069 | rio_dprintk(RIO_DEBUG_TTY, "TCRIORTSFLOWEN\n"); |
1103 | PortP->Config |= RIO_RTSFLOW; | 1070 | PortP->Config |= RIO_RTSFLOW; |
1104 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | 1071 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); |
1105 | RIOParam(PortP,CONFIG,Modem,OK_TO_SLEEP); | 1072 | RIOParam(PortP, CONFIG, Modem, OK_TO_SLEEP); |
1106 | return 0; | 1073 | return 0; |
1107 | 1074 | ||
1108 | case TCRIORTSFLOWDIS: | 1075 | case TCRIORTSFLOWDIS: |
1109 | rio_dprintk (RIO_DEBUG_TTY, "TCRIORTSFLOWDIS\n"); | 1076 | rio_dprintk(RIO_DEBUG_TTY, "TCRIORTSFLOWDIS\n"); |
1110 | PortP->Config &= ~RIO_RTSFLOW; | 1077 | PortP->Config &= ~RIO_RTSFLOW; |
1111 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | 1078 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); |
1112 | RIOParam(PortP,CONFIG,Modem,OK_TO_SLEEP); | 1079 | RIOParam(PortP, CONFIG, Modem, OK_TO_SLEEP); |
1113 | return 0; | 1080 | return 0; |
1114 | 1081 | ||
1115 | /* end ESIL 0761 part fix */ | 1082 | /* end ESIL 0761 part fix */ |
1116 | 1083 | ||
@@ -1119,35 +1086,35 @@ riotioctl(struct rio_info *p, struct tty_struct *tty, int cmd, caddr_t arg) | |||
1119 | 1086 | ||
1120 | /* Lynx IOCTLS */ | 1087 | /* Lynx IOCTLS */ |
1121 | switch (cmd) { | 1088 | switch (cmd) { |
1122 | case TIOCSETP: | 1089 | case TIOCSETP: |
1123 | case TIOCSETN: | 1090 | case TIOCSETN: |
1124 | case OTIOCSETP: | 1091 | case OTIOCSETP: |
1125 | case OTIOCSETN: | 1092 | case OTIOCSETN: |
1126 | ioctl_processed++; | 1093 | ioctl_processed++; |
1127 | ttyseth(PortP, tp, (struct old_sgttyb *)arg); | 1094 | ttyseth(PortP, tp, (struct old_sgttyb *) arg); |
1128 | break; | 1095 | break; |
1129 | case TCSETA: | 1096 | case TCSETA: |
1130 | case TCSETAW: | 1097 | case TCSETAW: |
1131 | case TCSETAF: | 1098 | case TCSETAF: |
1132 | ioctl_processed++; | 1099 | ioctl_processed++; |
1133 | rio_dprintk (RIO_DEBUG_TTY, "NON POSIX ioctl\n"); | 1100 | rio_dprintk(RIO_DEBUG_TTY, "NON POSIX ioctl\n"); |
1134 | ttyseth_pv(PortP, tp, (struct termios *)arg, 0); | 1101 | ttyseth_pv(PortP, tp, (struct termios *) arg, 0); |
1135 | break; | 1102 | break; |
1136 | case TCSETAP: /* posix tcsetattr() */ | 1103 | case TCSETAP: /* posix tcsetattr() */ |
1137 | case TCSETAWP: /* posix tcsetattr() */ | 1104 | case TCSETAWP: /* posix tcsetattr() */ |
1138 | case TCSETAFP: /* posix tcsetattr() */ | 1105 | case TCSETAFP: /* posix tcsetattr() */ |
1139 | rio_dprintk (RIO_DEBUG_TTY, "NON POSIX SYSV ioctl\n"); | 1106 | rio_dprintk(RIO_DEBUG_TTY, "NON POSIX SYSV ioctl\n"); |
1140 | ttyseth_pv(PortP, tp, (struct termios *)arg, 1); | 1107 | ttyseth_pv(PortP, tp, (struct termios *) arg, 1); |
1141 | ioctl_processed++; | 1108 | ioctl_processed++; |
1142 | break; | 1109 | break; |
1143 | } | 1110 | } |
1144 | 1111 | ||
1145 | /* | 1112 | /* |
1146 | ** If its any of the commands that require the port to be in the | 1113 | ** If its any of the commands that require the port to be in the |
1147 | ** non-busy state wait until all output has drained | 1114 | ** non-busy state wait until all output has drained |
1148 | */ | 1115 | */ |
1149 | if (!ioctl_processed) | 1116 | if (!ioctl_processed) |
1150 | switch(cmd) { | 1117 | switch (cmd) { |
1151 | case TCSETAW: | 1118 | case TCSETAW: |
1152 | case TCSETAF: | 1119 | case TCSETAF: |
1153 | case TCSETA: | 1120 | case TCSETA: |
@@ -1171,29 +1138,29 @@ riotioctl(struct rio_info *p, struct tty_struct *tty, int cmd, caddr_t arg) | |||
1171 | #endif | 1138 | #endif |
1172 | case TIOCSETD: | 1139 | case TIOCSETD: |
1173 | case TIOCSETN: | 1140 | case TIOCSETN: |
1174 | rio_dprintk (RIO_DEBUG_TTY, "wait for non-BUSY, semaphore set\n"); | 1141 | rio_dprintk(RIO_DEBUG_TTY, "wait for non-BUSY, semaphore set\n"); |
1175 | /* | 1142 | /* |
1176 | ** Wait for drain here, at least as far as the double buffer | 1143 | ** Wait for drain here, at least as far as the double buffer |
1177 | ** being empty. | 1144 | ** being empty. |
1178 | */ | 1145 | */ |
1179 | /* XXX Does the above comment mean that this has | 1146 | /* XXX Does the above comment mean that this has |
1180 | still to be implemented? -- REW */ | 1147 | still to be implemented? -- REW */ |
1181 | /* XXX Is the locking OK together with locking | 1148 | /* XXX Is the locking OK together with locking |
1182 | in txenable? (Deadlock?) -- REW */ | 1149 | in txenable? (Deadlock?) -- REW */ |
1183 | 1150 | ||
1184 | RIOTxEnable((char *)PortP); | 1151 | RIOTxEnable((char *) PortP); |
1185 | break; | 1152 | break; |
1186 | default: | 1153 | default: |
1187 | break; | 1154 | break; |
1188 | } | 1155 | } |
1189 | 1156 | ||
1190 | old_cflag = tp->tm.c_cflag; | 1157 | old_cflag = tp->tm.c_cflag; |
1191 | old_iflag = tp->tm.c_iflag; | 1158 | old_iflag = tp->tm.c_iflag; |
1192 | old_oflag = tp->tm.c_oflag; | 1159 | old_oflag = tp->tm.c_oflag; |
1193 | oldcook = PortP->CookMode; | 1160 | oldcook = PortP->CookMode; |
1194 | 1161 | ||
1195 | if ( p->RIOHalted ) { | 1162 | if (p->RIOHalted) { |
1196 | RIOClearUp( PortP ); | 1163 | RIOClearUp(PortP); |
1197 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | 1164 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); |
1198 | pseterr(EIO); | 1165 | pseterr(EIO); |
1199 | return 0; | 1166 | return 0; |
@@ -1202,10 +1169,10 @@ riotioctl(struct rio_info *p, struct tty_struct *tty, int cmd, caddr_t arg) | |||
1202 | PortP->FlushCmdBodge = 0; | 1169 | PortP->FlushCmdBodge = 0; |
1203 | 1170 | ||
1204 | /* | 1171 | /* |
1205 | ** If the port is locked, and it is reconfigured, we want | 1172 | ** If the port is locked, and it is reconfigured, we want |
1206 | ** to restore the state of the tty structure so the change is NOT | 1173 | ** to restore the state of the tty structure so the change is NOT |
1207 | ** made. | 1174 | ** made. |
1208 | */ | 1175 | */ |
1209 | if (PortP->Lock) { | 1176 | if (PortP->Lock) { |
1210 | tp->tm.c_iflag = PortP->StoredTty.iflag; | 1177 | tp->tm.c_iflag = PortP->StoredTty.iflag; |
1211 | tp->tm.c_oflag = PortP->StoredTty.oflag; | 1178 | tp->tm.c_oflag = PortP->StoredTty.oflag; |
@@ -1214,13 +1181,12 @@ riotioctl(struct rio_info *p, struct tty_struct *tty, int cmd, caddr_t arg) | |||
1214 | tp->tm.c_line = PortP->StoredTty.line; | 1181 | tp->tm.c_line = PortP->StoredTty.line; |
1215 | for (i = 0; i < NCC + 1; i++) | 1182 | for (i = 0; i < NCC + 1; i++) |
1216 | tp->tm.c_cc[i] = PortP->StoredTty.cc[i]; | 1183 | tp->tm.c_cc[i] = PortP->StoredTty.cc[i]; |
1217 | } | 1184 | } else { |
1218 | else { | ||
1219 | /* | 1185 | /* |
1220 | ** If the port is set to store the parameters, and it is | 1186 | ** If the port is set to store the parameters, and it is |
1221 | ** reconfigured, we want to save the current tty struct so it | 1187 | ** reconfigured, we want to save the current tty struct so it |
1222 | ** may be restored on the next open. | 1188 | ** may be restored on the next open. |
1223 | */ | 1189 | */ |
1224 | if (PortP->Store) { | 1190 | if (PortP->Store) { |
1225 | PortP->StoredTty.iflag = tp->tm.c_iflag; | 1191 | PortP->StoredTty.iflag = tp->tm.c_iflag; |
1226 | PortP->StoredTty.oflag = tp->tm.c_oflag; | 1192 | PortP->StoredTty.oflag = tp->tm.c_oflag; |
@@ -1232,44 +1198,41 @@ riotioctl(struct rio_info *p, struct tty_struct *tty, int cmd, caddr_t arg) | |||
1232 | } | 1198 | } |
1233 | } | 1199 | } |
1234 | 1200 | ||
1235 | changed = (tp->tm.c_cflag != old_cflag) || | 1201 | changed = (tp->tm.c_cflag != old_cflag) || (tp->tm.c_iflag != old_iflag) || (tp->tm.c_oflag != old_oflag); |
1236 | (tp->tm.c_iflag != old_iflag) || | ||
1237 | (tp->tm.c_oflag != old_oflag); | ||
1238 | 1202 | ||
1239 | PortP->CookMode = RIOCookMode(tp); /* Set new cooking mode */ | 1203 | PortP->CookMode = RIOCookMode(tp); /* Set new cooking mode */ |
1240 | 1204 | ||
1241 | rio_dprintk (RIO_DEBUG_TTY, "RIOIoctl changed %d newcook %d oldcook %d\n", | 1205 | rio_dprintk(RIO_DEBUG_TTY, "RIOIoctl changed %d newcook %d oldcook %d\n", changed, PortP->CookMode, oldcook); |
1242 | changed,PortP->CookMode,oldcook); | ||
1243 | 1206 | ||
1244 | #ifdef MODEM_SUPPORT | 1207 | #ifdef MODEM_SUPPORT |
1245 | /* | 1208 | /* |
1246 | ** kludge to force CARR_ON if CLOCAL set | 1209 | ** kludge to force CARR_ON if CLOCAL set |
1247 | */ | 1210 | */ |
1248 | if ((tp->tm.c_cflag & CLOCAL) || (PortP->ModemState & MSVR1_CD)) { | 1211 | if ((tp->tm.c_cflag & CLOCAL) || (PortP->ModemState & MSVR1_CD)) { |
1249 | tp->tm.c_state |= CARR_ON; | 1212 | tp->tm.c_state |= CARR_ON; |
1250 | wakeup ((caddr_t)&tp->tm.c_canq); | 1213 | wakeup((caddr_t) & tp->tm.c_canq); |
1251 | } | 1214 | } |
1252 | #endif | 1215 | #endif |
1253 | 1216 | ||
1254 | if ( p->RIOHalted ) { | 1217 | if (p->RIOHalted) { |
1255 | RIOClearUp( PortP ); | 1218 | RIOClearUp(PortP); |
1256 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | 1219 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); |
1257 | pseterr(EIO); | 1220 | pseterr(EIO); |
1258 | return 0; | 1221 | return 0; |
1259 | } | 1222 | } |
1260 | /* | 1223 | /* |
1261 | ** Re-configure if modes or cooking have changed | 1224 | ** Re-configure if modes or cooking have changed |
1262 | */ | 1225 | */ |
1263 | if (changed || oldcook != PortP->CookMode || (ioctl_processed)) { | 1226 | if (changed || oldcook != PortP->CookMode || (ioctl_processed)) { |
1264 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | 1227 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); |
1265 | rio_dprintk (RIO_DEBUG_TTY, "Ioctl changing the PORT settings\n"); | 1228 | rio_dprintk(RIO_DEBUG_TTY, "Ioctl changing the PORT settings\n"); |
1266 | RIOParam(PortP,CONFIG,Modem,OK_TO_SLEEP); | 1229 | RIOParam(PortP, CONFIG, Modem, OK_TO_SLEEP); |
1267 | rio_spin_lock_irqsave(&PortP->portSem, flags); | 1230 | rio_spin_lock_irqsave(&PortP->portSem, flags); |
1268 | } | 1231 | } |
1269 | 1232 | ||
1270 | if (p->RIOHalted) { | 1233 | if (p->RIOHalted) { |
1271 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | 1234 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); |
1272 | RIOClearUp( PortP ); | 1235 | RIOClearUp(PortP); |
1273 | pseterr(EIO); | 1236 | pseterr(EIO); |
1274 | return 0; | 1237 | return 0; |
1275 | } | 1238 | } |
@@ -1280,36 +1243,32 @@ riotioctl(struct rio_info *p, struct tty_struct *tty, int cmd, caddr_t arg) | |||
1280 | /* | 1243 | /* |
1281 | ttyseth -- set hardware dependent tty settings | 1244 | ttyseth -- set hardware dependent tty settings |
1282 | */ | 1245 | */ |
1283 | void | 1246 | void ttyseth(PortP, s, sg) |
1284 | ttyseth(PortP, s, sg) | 1247 | struct Port *PortP; |
1285 | struct Port * PortP; | 1248 | struct ttystatics *s; |
1286 | struct ttystatics * s; | ||
1287 | struct old_sgttyb *sg; | 1249 | struct old_sgttyb *sg; |
1288 | { | 1250 | { |
1289 | struct old_sgttyb * tsg; | 1251 | struct old_sgttyb *tsg; |
1290 | struct termios *tp = &s->tm; | 1252 | struct termios *tp = &s->tm; |
1291 | 1253 | ||
1292 | tsg = &s->sg; | 1254 | tsg = &s->sg; |
1293 | 1255 | ||
1294 | if (sg->sg_flags & (EVENP|ODDP)) { | 1256 | if (sg->sg_flags & (EVENP | ODDP)) { |
1295 | tp->c_cflag &= PARENB; | 1257 | tp->c_cflag &= PARENB; |
1296 | if (sg->sg_flags & EVENP) { | 1258 | if (sg->sg_flags & EVENP) { |
1297 | if (sg->sg_flags & ODDP) { | 1259 | if (sg->sg_flags & ODDP) { |
1298 | tp->c_cflag &= V_CS7; | 1260 | tp->c_cflag &= V_CS7; |
1299 | tp->c_cflag &= ~PARENB; | 1261 | tp->c_cflag &= ~PARENB; |
1300 | } | 1262 | } else { |
1301 | else { | ||
1302 | tp->c_cflag &= V_CS7; | 1263 | tp->c_cflag &= V_CS7; |
1303 | tp->c_cflag &= PARENB; | 1264 | tp->c_cflag &= PARENB; |
1304 | tp->c_cflag &= PARODD; | 1265 | tp->c_cflag &= PARODD; |
1305 | } | 1266 | } |
1306 | } | 1267 | } else if (sg->sg_flags & ODDP) { |
1307 | else if (sg->sg_flags & ODDP) { | ||
1308 | tp->c_cflag &= V_CS7; | 1268 | tp->c_cflag &= V_CS7; |
1309 | tp->c_cflag &= PARENB; | 1269 | tp->c_cflag &= PARENB; |
1310 | tp->c_cflag &= PARODD; | 1270 | tp->c_cflag &= PARODD; |
1311 | } | 1271 | } else { |
1312 | else { | ||
1313 | tp->c_cflag &= V_CS7; | 1272 | tp->c_cflag &= V_CS7; |
1314 | tp->c_cflag &= PARENB; | 1273 | tp->c_cflag &= PARENB; |
1315 | } | 1274 | } |
@@ -1320,16 +1279,16 @@ struct old_sgttyb *sg; | |||
1320 | * I will have to use separate sets of flags to store them in the | 1279 | * I will have to use separate sets of flags to store them in the |
1321 | * Port structure. | 1280 | * Port structure. |
1322 | */ | 1281 | */ |
1323 | if ( !sg->sg_ospeed ) | 1282 | if (!sg->sg_ospeed) |
1324 | sg->sg_ospeed = sg->sg_ispeed; | 1283 | sg->sg_ospeed = sg->sg_ispeed; |
1325 | else | 1284 | else |
1326 | sg->sg_ispeed = sg->sg_ospeed; | 1285 | sg->sg_ispeed = sg->sg_ospeed; |
1327 | if (sg->sg_ispeed > V_EXTB ) | 1286 | if (sg->sg_ispeed > V_EXTB) |
1328 | sg->sg_ispeed = V_EXTB; | 1287 | sg->sg_ispeed = V_EXTB; |
1329 | if (sg->sg_ispeed < V_B0) | 1288 | if (sg->sg_ispeed < V_B0) |
1330 | sg->sg_ispeed = V_B0; | 1289 | sg->sg_ispeed = V_B0; |
1331 | *tsg = *sg; | 1290 | *tsg = *sg; |
1332 | tp->c_cflag = (tp->c_cflag & ~V_CBAUD) | conv_bv[(int)sg->sg_ispeed]; | 1291 | tp->c_cflag = (tp->c_cflag & ~V_CBAUD) | conv_bv[(int) sg->sg_ispeed]; |
1333 | } | 1292 | } |
1334 | 1293 | ||
1335 | /* | 1294 | /* |
@@ -1338,36 +1297,33 @@ struct old_sgttyb *sg; | |||
1338 | sysv = 0 => (POSIX): struct termios *sg | 1297 | sysv = 0 => (POSIX): struct termios *sg |
1339 | sysv != 0 => (System V): struct termio *sg | 1298 | sysv != 0 => (System V): struct termio *sg |
1340 | */ | 1299 | */ |
1341 | static void | 1300 | static void ttyseth_pv(PortP, s, sg, sysv) |
1342 | ttyseth_pv(PortP, s, sg, sysv) | ||
1343 | struct Port *PortP; | 1301 | struct Port *PortP; |
1344 | struct ttystatics *s; | 1302 | struct ttystatics *s; |
1345 | struct termios *sg; | 1303 | struct termios *sg; |
1346 | int sysv; | 1304 | int sysv; |
1347 | { | 1305 | { |
1348 | int speed; | 1306 | int speed; |
1349 | unsigned char csize; | 1307 | unsigned char csize; |
1350 | unsigned char cread; | 1308 | unsigned char cread; |
1351 | unsigned int lcr_flags; | 1309 | unsigned int lcr_flags; |
1352 | int ps; | 1310 | int ps; |
1353 | 1311 | ||
1354 | if (sysv) { | 1312 | if (sysv) { |
1355 | /* sg points to a System V termio structure */ | 1313 | /* sg points to a System V termio structure */ |
1356 | csize = ((struct termio *)sg)->c_cflag & CSIZE; | 1314 | csize = ((struct termio *) sg)->c_cflag & CSIZE; |
1357 | cread = ((struct termio *)sg)->c_cflag & CREAD; | 1315 | cread = ((struct termio *) sg)->c_cflag & CREAD; |
1358 | speed = conv_vb[((struct termio *)sg)->c_cflag & V_CBAUD]; | 1316 | speed = conv_vb[((struct termio *) sg)->c_cflag & V_CBAUD]; |
1359 | } | 1317 | } else { |
1360 | else { | 1318 | /* sg points to a POSIX termios structure */ |
1361 | /* sg points to a POSIX termios structure */ | 1319 | csize = sg->c_cflag & CSIZE; |
1362 | csize = sg->c_cflag & CSIZE; | 1320 | cread = sg->c_cflag & CREAD; |
1363 | cread = sg->c_cflag & CREAD; | 1321 | speed = conv_vb[sg->c_cflag & V_CBAUD]; |
1364 | speed = conv_vb[sg->c_cflag & V_CBAUD]; | 1322 | } |
1365 | } | 1323 | if (s->sg.sg_ispeed != speed || s->sg.sg_ospeed != speed) { |
1366 | if (s->sg.sg_ispeed != speed || s->sg.sg_ospeed != speed) { | 1324 | s->sg.sg_ispeed = speed; |
1367 | s->sg.sg_ispeed = speed; | 1325 | s->sg.sg_ospeed = speed; |
1368 | s->sg.sg_ospeed = speed; | 1326 | s->tm.c_cflag = (s->tm.c_cflag & ~V_CBAUD) | conv_bv[(int) s->sg.sg_ispeed]; |
1369 | s->tm.c_cflag = (s->tm.c_cflag & ~V_CBAUD) | | 1327 | } |
1370 | conv_bv[(int)s->sg.sg_ispeed]; | ||
1371 | } | ||
1372 | } | 1328 | } |
1373 | #endif | 1329 | #endif |
diff --git a/drivers/char/rio/riotypes.h b/drivers/char/rio/riotypes.h index 1c7c42c638f0..9b67e2468bec 100644 --- a/drivers/char/rio/riotypes.h +++ b/drivers/char/rio/riotypes.h | |||
@@ -89,47 +89,46 @@ typedef RIO_POINTER u_short_ptr; | |||
89 | typedef RIO_POINTER ushort_ptr; | 89 | typedef RIO_POINTER ushort_ptr; |
90 | #endif | 90 | #endif |
91 | 91 | ||
92 | #else /* not INKERNEL */ | 92 | #else /* not INKERNEL */ |
93 | typedef unsigned char BYTE; | 93 | typedef unsigned char BYTE; |
94 | typedef unsigned short WORD; | 94 | typedef unsigned short WORD; |
95 | typedef unsigned long DWORD; | 95 | typedef unsigned long DWORD; |
96 | typedef short NUMBER; | 96 | typedef short NUMBER; |
97 | typedef short *NUMBER_ptr; | 97 | typedef short *NUMBER_ptr; |
98 | typedef unsigned short *WORD_ptr; | 98 | typedef unsigned short *WORD_ptr; |
99 | typedef unsigned char *BYTE_ptr; | 99 | typedef unsigned char *BYTE_ptr; |
100 | typedef unsigned char uchar ; | 100 | typedef unsigned char uchar; |
101 | typedef unsigned short ushort ; | 101 | typedef unsigned short ushort; |
102 | typedef unsigned int uint ; | 102 | typedef unsigned int uint; |
103 | typedef unsigned long ulong ; | 103 | typedef unsigned long ulong; |
104 | typedef unsigned char u_char ; | 104 | typedef unsigned char u_char; |
105 | typedef unsigned short u_short ; | 105 | typedef unsigned short u_short; |
106 | typedef unsigned int u_int ; | 106 | typedef unsigned int u_int; |
107 | typedef unsigned long u_long ; | 107 | typedef unsigned long u_long; |
108 | typedef unsigned short ERROR ; | 108 | typedef unsigned short ERROR; |
109 | typedef unsigned long ID ; | 109 | typedef unsigned long ID; |
110 | typedef char *char_ptr; | 110 | typedef char *char_ptr; |
111 | typedef Channel *Channel_ptr; | 111 | typedef Channel *Channel_ptr; |
112 | typedef struct FREE_LIST *FREE_LIST_ptr; | 112 | typedef struct FREE_LIST *FREE_LIST_ptr; |
113 | typedef struct FREE_LIST **FREE_LIST_ptr_ptr; | 113 | typedef struct FREE_LIST **FREE_LIST_ptr_ptr; |
114 | typedef struct LPB *LPB_ptr; | 114 | typedef struct LPB *LPB_ptr; |
115 | typedef struct Process *Process_ptr; | 115 | typedef struct Process *Process_ptr; |
116 | typedef struct PHB *PHB_ptr; | 116 | typedef struct PHB *PHB_ptr; |
117 | typedef struct PKT *PKT_ptr; | 117 | typedef struct PKT *PKT_ptr; |
118 | typedef struct PKT **PKT_ptr_ptr; | 118 | typedef struct PKT **PKT_ptr_ptr; |
119 | typedef struct Q_BUF *Q_BUF_ptr; | 119 | typedef struct Q_BUF *Q_BUF_ptr; |
120 | typedef struct Q_BUF **Q_BUF_ptr_ptr; | 120 | typedef struct Q_BUF **Q_BUF_ptr_ptr; |
121 | typedef struct ROUTE_STR *ROUTE_STR_ptr; | 121 | typedef struct ROUTE_STR *ROUTE_STR_ptr; |
122 | typedef struct RUP *RUP_ptr; | 122 | typedef struct RUP *RUP_ptr; |
123 | typedef short *short_ptr; | 123 | typedef short *short_ptr; |
124 | typedef u_short *u_short_ptr; | 124 | typedef u_short *u_short_ptr; |
125 | typedef ushort *ushort_ptr; | 125 | typedef ushort *ushort_ptr; |
126 | typedef struct PKT PKT; | 126 | typedef struct PKT PKT; |
127 | typedef struct LPB LPB; | 127 | typedef struct LPB LPB; |
128 | typedef struct RUP RUP; | 128 | typedef struct RUP RUP; |
129 | #endif | 129 | #endif |
130 | 130 | ||
131 | 131 | ||
132 | #endif /* __riotypes__ */ | 132 | #endif /* __riotypes__ */ |
133 | 133 | ||
134 | /*********** end of file ***********/ | 134 | /*********** end of file ***********/ |
135 | |||
diff --git a/drivers/char/rio/riowinif.h b/drivers/char/rio/riowinif.h index 18a4f147edc2..f802d7593b80 100644 --- a/drivers/char/rio/riowinif.h +++ b/drivers/char/rio/riowinif.h | |||
@@ -40,7 +40,7 @@ | |||
40 | 40 | ||
41 | */ | 41 | */ |
42 | 42 | ||
43 | #ifndef _riowinif_h /* If RIOWINDIF.H not already defined */ | 43 | #ifndef _riowinif_h /* If RIOWINDIF.H not already defined */ |
44 | #define _riowinif_h 1 | 44 | #define _riowinif_h 1 |
45 | 45 | ||
46 | /***************************************************************************** | 46 | /***************************************************************************** |
@@ -60,42 +60,41 @@ | |||
60 | /* The PARM_MAP structure defines global values relating to the Host Card / RTA | 60 | /* The PARM_MAP structure defines global values relating to the Host Card / RTA |
61 | and is the main structure from which all other structures are referenced. */ | 61 | and is the main structure from which all other structures are referenced. */ |
62 | 62 | ||
63 | typedef struct _PARM_MAP | 63 | typedef struct _PARM_MAP { |
64 | { | 64 | _u16 phb_ptr; /* 0x00 Pointer to the PHB array */ |
65 | _u16 phb_ptr; /* 0x00 Pointer to the PHB array */ | 65 | _u16 phb_num_ptr; /* 0x02 Ptr to Number of PHB's */ |
66 | _u16 phb_num_ptr; /* 0x02 Ptr to Number of PHB's */ | 66 | _u16 free_list; /* 0x04 Free List pointer */ |
67 | _u16 free_list; /* 0x04 Free List pointer */ | 67 | _u16 free_list_end; /* 0x06 Free List End pointer */ |
68 | _u16 free_list_end; /* 0x06 Free List End pointer */ | 68 | _u16 q_free_list_ptr; /* 0x08 Ptr to Q_BUF variable */ |
69 | _u16 q_free_list_ptr; /* 0x08 Ptr to Q_BUF variable */ | 69 | _u16 unit_id_ptr; /* 0x0A Unit Id */ |
70 | _u16 unit_id_ptr; /* 0x0A Unit Id */ | 70 | _u16 link_str_ptr; /* 0x0C Link Structure Array */ |
71 | _u16 link_str_ptr; /* 0x0C Link Structure Array */ | 71 | _u16 bootloader_1; /* 0x0E 1st Stage Boot Loader */ |
72 | _u16 bootloader_1; /* 0x0E 1st Stage Boot Loader */ | 72 | _u16 bootloader_2; /* 0x10 2nd Stage Boot Loader */ |
73 | _u16 bootloader_2; /* 0x10 2nd Stage Boot Loader */ | 73 | _u16 port_route_map_ptr; /* 0x12 Port Route Map */ |
74 | _u16 port_route_map_ptr; /* 0x12 Port Route Map */ | 74 | _u16 route_ptr; /* 0x14 Route Map */ |
75 | _u16 route_ptr; /* 0x14 Route Map */ | 75 | _u16 map_present; /* 0x16 Route Map present */ |
76 | _u16 map_present; /* 0x16 Route Map present */ | 76 | _u16 pkt_num; /* 0x18 Total number of packets */ |
77 | _u16 pkt_num; /* 0x18 Total number of packets */ | 77 | _u16 q_num; /* 0x1A Total number of Q packets */ |
78 | _u16 q_num; /* 0x1A Total number of Q packets */ | 78 | _u16 buffers_per_port; /* 0x1C Number of buffers per port */ |
79 | _u16 buffers_per_port; /* 0x1C Number of buffers per port */ | 79 | _u16 heap_size; /* 0x1E Initial size of heap */ |
80 | _u16 heap_size; /* 0x1E Initial size of heap */ | 80 | _u16 heap_left; /* 0x20 Current Heap left */ |
81 | _u16 heap_left; /* 0x20 Current Heap left */ | 81 | _u16 error; /* 0x22 Error code */ |
82 | _u16 error; /* 0x22 Error code */ | 82 | _u16 tx_max; /* 0x24 Max number of tx pkts per phb */ |
83 | _u16 tx_max; /* 0x24 Max number of tx pkts per phb */ | 83 | _u16 rx_max; /* 0x26 Max number of rx pkts per phb */ |
84 | _u16 rx_max; /* 0x26 Max number of rx pkts per phb */ | 84 | _u16 rx_limit; /* 0x28 For high / low watermarks */ |
85 | _u16 rx_limit; /* 0x28 For high / low watermarks */ | 85 | _u16 links; /* 0x2A Links to use */ |
86 | _u16 links; /* 0x2A Links to use */ | 86 | _u16 timer; /* 0x2C Interrupts per second */ |
87 | _u16 timer; /* 0x2C Interrupts per second */ | 87 | _u16 rups; /* 0x2E Pointer to the RUPs */ |
88 | _u16 rups; /* 0x2E Pointer to the RUPs */ | 88 | _u16 max_phb; /* 0x30 Mostly for debugging */ |
89 | _u16 max_phb; /* 0x30 Mostly for debugging */ | 89 | _u16 living; /* 0x32 Just increments!! */ |
90 | _u16 living; /* 0x32 Just increments!! */ | 90 | _u16 init_done; /* 0x34 Initialisation over */ |
91 | _u16 init_done; /* 0x34 Initialisation over */ | 91 | _u16 booting_link; /* 0x36 */ |
92 | _u16 booting_link; /* 0x36 */ | 92 | _u16 idle_count; /* 0x38 Idle time counter */ |
93 | _u16 idle_count; /* 0x38 Idle time counter */ | 93 | _u16 busy_count; /* 0x3A Busy counter */ |
94 | _u16 busy_count; /* 0x3A Busy counter */ | 94 | _u16 idle_control; /* 0x3C Control Idle Process */ |
95 | _u16 idle_control; /* 0x3C Control Idle Process */ | 95 | _u16 tx_intr; /* 0x3E TX interrupt pending */ |
96 | _u16 tx_intr; /* 0x3E TX interrupt pending */ | 96 | _u16 rx_intr; /* 0x40 RX interrupt pending */ |
97 | _u16 rx_intr; /* 0x40 RX interrupt pending */ | 97 | _u16 rup_intr; /* 0x42 RUP interrupt pending */ |
98 | _u16 rup_intr; /* 0x42 RUP interrupt pending */ | ||
99 | 98 | ||
100 | } PARM_MAP; | 99 | } PARM_MAP; |
101 | 100 | ||
@@ -184,45 +183,44 @@ typedef struct _PARM_MAP | |||
184 | attached to the system and there is normally an array of MAX_RUPS (=16) structures | 183 | attached to the system and there is normally an array of MAX_RUPS (=16) structures |
185 | in a host card, defined by PARM_MAP->rup. */ | 184 | in a host card, defined by PARM_MAP->rup. */ |
186 | 185 | ||
187 | typedef struct _RUP | 186 | typedef struct _RUP { |
188 | { | 187 | _u16 txpkt; /* 0x00 Outgoing packet */ |
189 | _u16 txpkt; /* 0x00 Outgoing packet */ | 188 | _u16 rxpkt; /* 0x02 ncoming packet */ |
190 | _u16 rxpkt; /* 0x02 ncoming packet */ | 189 | _u16 link; /* 0x04 Which link to send packet down ? */ |
191 | _u16 link; /* 0x04 Which link to send packet down ? */ | 190 | _u8 rup_dest_unit[2]; /* 0x06 Destination Unit */ |
192 | _u8 rup_dest_unit[2]; /* 0x06 Destination Unit */ | 191 | _u16 handshake; /* 0x08 Handshaking */ |
193 | _u16 handshake; /* 0x08 Handshaking */ | 192 | _u16 timeout; /* 0x0A Timeout */ |
194 | _u16 timeout; /* 0x0A Timeout */ | 193 | _u16 status; /* 0x0C Status */ |
195 | _u16 status; /* 0x0C Status */ | 194 | _u16 txcontrol; /* 0x0E Transmit control */ |
196 | _u16 txcontrol; /* 0x0E Transmit control */ | 195 | _u16 rxcontrol; /* 0x10 Receive control */ |
197 | _u16 rxcontrol; /* 0x10 Receive control */ | ||
198 | 196 | ||
199 | } RUP; | 197 | } RUP; |
200 | 198 | ||
201 | /* Same thing again, but defined as offsets... */ | 199 | /* Same thing again, but defined as offsets... */ |
202 | 200 | ||
203 | #define RUP_txpkt 0x00 /* 0x00 Outgoing packet */ | 201 | #define RUP_txpkt 0x00 /* 0x00 Outgoing packet */ |
204 | #define RUP_rxpkt 0x02 /* 0x02 Incoming packet */ | 202 | #define RUP_rxpkt 0x02 /* 0x02 Incoming packet */ |
205 | #define RUP_link 0x04 /* 0x04 Which link to send packet down ? */ | 203 | #define RUP_link 0x04 /* 0x04 Which link to send packet down ? */ |
206 | #define RUP_rup_dest_unit 0x06 /* 0x06 Destination Unit */ | 204 | #define RUP_rup_dest_unit 0x06 /* 0x06 Destination Unit */ |
207 | #define RUP_handshake 0x08 /* 0x08 Handshaking */ | 205 | #define RUP_handshake 0x08 /* 0x08 Handshaking */ |
208 | #define RUP_timeout 0x0A /* 0x0A Timeout */ | 206 | #define RUP_timeout 0x0A /* 0x0A Timeout */ |
209 | #define RUP_status 0x0C /* 0x0C Status */ | 207 | #define RUP_status 0x0C /* 0x0C Status */ |
210 | #define RUP_txcontrol 0x0E /* 0x0E Transmit control */ | 208 | #define RUP_txcontrol 0x0E /* 0x0E Transmit control */ |
211 | #define RUP_rxcontrol 0x10 /* 0x10 Receive control */ | 209 | #define RUP_rxcontrol 0x10 /* 0x10 Receive control */ |
212 | #define sizeof_RUP 0x12 /* structure size = 0x12 */ | 210 | #define sizeof_RUP 0x12 /* structure size = 0x12 */ |
213 | 211 | ||
214 | #define MAX_RUP 16 | 212 | #define MAX_RUP 16 |
215 | 213 | ||
216 | /* RUP.txcontrol definitions... */ | 214 | /* RUP.txcontrol definitions... */ |
217 | #define TX_RUP_INACTIVE 0 /* Nothing to transmit */ | 215 | #define TX_RUP_INACTIVE 0 /* Nothing to transmit */ |
218 | #define TX_PACKET_READY 1 /* Transmit packet ready */ | 216 | #define TX_PACKET_READY 1 /* Transmit packet ready */ |
219 | #define TX_LOCK_RUP 2 /* Transmit side locked */ | 217 | #define TX_LOCK_RUP 2 /* Transmit side locked */ |
220 | 218 | ||
221 | /* RUP.txcontrol definitions... */ | 219 | /* RUP.txcontrol definitions... */ |
222 | #define RX_RUP_INACTIVE 0 /* Nothing received */ | 220 | #define RX_RUP_INACTIVE 0 /* Nothing received */ |
223 | #define RX_PACKET_READY 1 /* Packet received */ | 221 | #define RX_PACKET_READY 1 /* Packet received */ |
224 | 222 | ||
225 | #define RUP_NO_OWNER 0xFF /* RUP not owned by any process */ | 223 | #define RUP_NO_OWNER 0xFF /* RUP not owned by any process */ |
226 | 224 | ||
227 | /***************************************************************************** | 225 | /***************************************************************************** |
228 | ********************************** *********************************** | 226 | ********************************** *********************************** |
@@ -234,52 +232,51 @@ typedef struct _RUP | |||
234 | to the system and there is normally an array of MAX_PHBS (=128) structures | 232 | to the system and there is normally an array of MAX_PHBS (=128) structures |
235 | in a host card, defined by PARM_MAP->phb_ptr and PARM_MAP->phb_num_ptr. */ | 233 | in a host card, defined by PARM_MAP->phb_ptr and PARM_MAP->phb_num_ptr. */ |
236 | 234 | ||
237 | typedef struct _PHB | 235 | typedef struct _PHB { |
238 | { | 236 | _u16 source; /* 0x00 Location of the PHB in the host card */ |
239 | _u16 source; /* 0x00 Location of the PHB in the host card */ | 237 | _u16 handshake; /* 0x02 Used to manage receive packet flow control */ |
240 | _u16 handshake; /* 0x02 Used to manage receive packet flow control */ | 238 | _u16 status; /* 0x04 Internal port transmit/receive status */ |
241 | _u16 status; /* 0x04 Internal port transmit/receive status */ | 239 | _u16 timeout; /* 0x06 Time period to wait for an ACK */ |
242 | _u16 timeout; /* 0x06 Time period to wait for an ACK */ | 240 | _u16 link; /* 0x08 The host link associated with the PHB */ |
243 | _u16 link; /* 0x08 The host link associated with the PHB */ | 241 | _u16 destination; /* 0x0A Location of the remote port on the network */ |
244 | _u16 destination; /* 0x0A Location of the remote port on the network */ | 242 | |
245 | 243 | _u16 tx_start; /* 0x0C first entry in the packet array for transmit packets */ | |
246 | _u16 tx_start; /* 0x0C first entry in the packet array for transmit packets */ | 244 | _u16 tx_end; /* 0x0E last entry in the packet array for transmit packets */ |
247 | _u16 tx_end; /* 0x0E last entry in the packet array for transmit packets */ | 245 | _u16 tx_add; /* 0x10 position in the packet array for new transmit packets */ |
248 | _u16 tx_add; /* 0x10 position in the packet array for new transmit packets */ | 246 | _u16 tx_remove; /* 0x12 current position in the packet pointer array */ |
249 | _u16 tx_remove; /* 0x12 current position in the packet pointer array */ | 247 | |
250 | 248 | _u16 rx_start; /* 0x14 first entry in the packet array for receive packets */ | |
251 | _u16 rx_start; /* 0x14 first entry in the packet array for receive packets */ | 249 | _u16 rx_end; /* 0x16 last entry in the packet array for receive packets */ |
252 | _u16 rx_end; /* 0x16 last entry in the packet array for receive packets */ | 250 | _u16 rx_add; /* 0x18 position in the packet array for new receive packets */ |
253 | _u16 rx_add; /* 0x18 position in the packet array for new receive packets */ | 251 | _u16 rx_remove; /* 0x1A current position in the packet pointer array */ |
254 | _u16 rx_remove; /* 0x1A current position in the packet pointer array */ | ||
255 | 252 | ||
256 | } PHB; | 253 | } PHB; |
257 | 254 | ||
258 | /* Same thing again, but defined as offsets... */ | 255 | /* Same thing again, but defined as offsets... */ |
259 | 256 | ||
260 | #define PHB_source 0x00 /* 0x00 Location of the PHB in the host card */ | 257 | #define PHB_source 0x00 /* 0x00 Location of the PHB in the host card */ |
261 | #define PHB_handshake 0x02 /* 0x02 Used to manage receive packet flow control */ | 258 | #define PHB_handshake 0x02 /* 0x02 Used to manage receive packet flow control */ |
262 | #define PHB_status 0x04 /* 0x04 Internal port transmit/receive status */ | 259 | #define PHB_status 0x04 /* 0x04 Internal port transmit/receive status */ |
263 | #define PHB_timeout 0x06 /* 0x06 Time period to wait for an ACK */ | 260 | #define PHB_timeout 0x06 /* 0x06 Time period to wait for an ACK */ |
264 | #define PHB_link 0x08 /* 0x08 The host link associated with the PHB */ | 261 | #define PHB_link 0x08 /* 0x08 The host link associated with the PHB */ |
265 | #define PHB_destination 0x0A /* 0x0A Location of the remote port on the network */ | 262 | #define PHB_destination 0x0A /* 0x0A Location of the remote port on the network */ |
266 | #define PHB_tx_start 0x0C /* 0x0C first entry in the packet array for transmit packets */ | 263 | #define PHB_tx_start 0x0C /* 0x0C first entry in the packet array for transmit packets */ |
267 | #define PHB_tx_end 0x0E /* 0x0E last entry in the packet array for transmit packets */ | 264 | #define PHB_tx_end 0x0E /* 0x0E last entry in the packet array for transmit packets */ |
268 | #define PHB_tx_add 0x10 /* 0x10 position in the packet array for new transmit packets */ | 265 | #define PHB_tx_add 0x10 /* 0x10 position in the packet array for new transmit packets */ |
269 | #define PHB_tx_remove 0x12 /* 0x12 current position in the packet pointer array */ | 266 | #define PHB_tx_remove 0x12 /* 0x12 current position in the packet pointer array */ |
270 | #define PHB_rx_start 0x14 /* 0x14 first entry in the packet array for receive packets */ | 267 | #define PHB_rx_start 0x14 /* 0x14 first entry in the packet array for receive packets */ |
271 | #define PHB_rx_end 0x16 /* 0x16 last entry in the packet array for receive packets */ | 268 | #define PHB_rx_end 0x16 /* 0x16 last entry in the packet array for receive packets */ |
272 | #define PHB_rx_add 0x18 /* 0x18 position in the packet array for new receive packets */ | 269 | #define PHB_rx_add 0x18 /* 0x18 position in the packet array for new receive packets */ |
273 | #define PHB_rx_remove 0x1A /* 0x1A current position in the packet pointer array */ | 270 | #define PHB_rx_remove 0x1A /* 0x1A current position in the packet pointer array */ |
274 | #define sizeof_PHB 0x1C /* structure size = 0x1C */ | 271 | #define sizeof_PHB 0x1C /* structure size = 0x1C */ |
275 | 272 | ||
276 | /* PHB.handshake definitions... */ | 273 | /* PHB.handshake definitions... */ |
277 | #define PHB_HANDSHAKE_SET 0x0001 /* Set by LRT */ | 274 | #define PHB_HANDSHAKE_SET 0x0001 /* Set by LRT */ |
278 | #define PHB_HANDSHAKE_RESET 0x0002 /* Set by ISR / driver */ | 275 | #define PHB_HANDSHAKE_RESET 0x0002 /* Set by ISR / driver */ |
279 | #define PHB_HANDSHAKE_FLAGS (PHB_HANDSHAKE_RESET|PHB_HANDSHAKE_SET) | 276 | #define PHB_HANDSHAKE_FLAGS (PHB_HANDSHAKE_RESET|PHB_HANDSHAKE_SET) |
280 | /* Reset by ltt */ | 277 | /* Reset by ltt */ |
281 | 278 | ||
282 | #define MAX_PHB 128 /* range 0-127 */ | 279 | #define MAX_PHB 128 /* range 0-127 */ |
283 | 280 | ||
284 | /***************************************************************************** | 281 | /***************************************************************************** |
285 | ********************************** *********************************** | 282 | ********************************** *********************************** |
@@ -291,86 +288,85 @@ typedef struct _PHB | |||
291 | and there is normally an array of MAX_LINKS (=4) structures in a host card, | 288 | and there is normally an array of MAX_LINKS (=4) structures in a host card, |
292 | defined by PARM_MAP->link_str_ptr. */ | 289 | defined by PARM_MAP->link_str_ptr. */ |
293 | 290 | ||
294 | typedef struct _LPB | 291 | typedef struct _LPB { |
295 | { | 292 | _u16 link_number; /* 0x00 Link Number */ |
296 | _u16 link_number; /* 0x00 Link Number */ | 293 | _u16 in_ch; /* 0x02 Link In Channel */ |
297 | _u16 in_ch; /* 0x02 Link In Channel */ | 294 | _u16 out_ch; /* 0x04 Link Out Channel */ |
298 | _u16 out_ch; /* 0x04 Link Out Channel */ | 295 | _u8 attached_serial[4]; /* 0x06 Attached serial number */ |
299 | _u8 attached_serial[4]; /* 0x06 Attached serial number */ | 296 | _u8 attached_host_serial[4]; /* 0x0A Serial number of Host who booted other end */ |
300 | _u8 attached_host_serial[4];/* 0x0A Serial number of Host who booted other end */ | 297 | _u16 descheduled; /* 0x0E Currently Descheduled */ |
301 | _u16 descheduled; /* 0x0E Currently Descheduled */ | 298 | _u16 state; /* 0x10 Current state */ |
302 | _u16 state; /* 0x10 Current state */ | 299 | _u16 send_poll; /* 0x12 Send a Poll Packet */ |
303 | _u16 send_poll; /* 0x12 Send a Poll Packet */ | 300 | _u16 ltt_p; /* 0x14 Process Descriptor */ |
304 | _u16 ltt_p; /* 0x14 Process Descriptor */ | 301 | _u16 lrt_p; /* 0x16 Process Descriptor */ |
305 | _u16 lrt_p; /* 0x16 Process Descriptor */ | 302 | _u16 lrt_status; /* 0x18 Current lrt status */ |
306 | _u16 lrt_status; /* 0x18 Current lrt status */ | 303 | _u16 ltt_status; /* 0x1A Current ltt status */ |
307 | _u16 ltt_status; /* 0x1A Current ltt status */ | 304 | _u16 timeout; /* 0x1C Timeout value */ |
308 | _u16 timeout; /* 0x1C Timeout value */ | 305 | _u16 topology; /* 0x1E Topology bits */ |
309 | _u16 topology; /* 0x1E Topology bits */ | 306 | _u16 mon_ltt; /* 0x20 */ |
310 | _u16 mon_ltt; /* 0x20 */ | 307 | _u16 mon_lrt; /* 0x22 */ |
311 | _u16 mon_lrt; /* 0x22 */ | 308 | _u16 num_pkts; /* 0x24 */ |
312 | _u16 num_pkts; /* 0x24 */ | 309 | _u16 add_packet_list; /* 0x26 Add packets to here */ |
313 | _u16 add_packet_list; /* 0x26 Add packets to here */ | 310 | _u16 remove_packet_list; /* 0x28 Send packets from here */ |
314 | _u16 remove_packet_list; /* 0x28 Send packets from here */ | 311 | |
315 | 312 | _u16 lrt_fail_chan; /* 0x2A Lrt's failure channel */ | |
316 | _u16 lrt_fail_chan; /* 0x2A Lrt's failure channel */ | 313 | _u16 ltt_fail_chan; /* 0x2C Ltt's failure channel */ |
317 | _u16 ltt_fail_chan; /* 0x2C Ltt's failure channel */ | 314 | |
318 | 315 | RUP rup; /* 0x2E RUP structure for HOST to driver comms */ | |
319 | RUP rup; /* 0x2E RUP structure for HOST to driver comms */ | 316 | RUP link_rup; /* 0x40 RUP for the link (POLL, topology etc.) */ |
320 | RUP link_rup; /* 0x40 RUP for the link (POLL, topology etc.) */ | 317 | _u16 attached_link; /* 0x52 Number of attached link */ |
321 | _u16 attached_link; /* 0x52 Number of attached link */ | 318 | _u16 csum_errors; /* 0x54 csum errors */ |
322 | _u16 csum_errors; /* 0x54 csum errors */ | 319 | _u16 num_disconnects; /* 0x56 number of disconnects */ |
323 | _u16 num_disconnects; /* 0x56 number of disconnects */ | 320 | _u16 num_sync_rcvd; /* 0x58 # sync's received */ |
324 | _u16 num_sync_rcvd; /* 0x58 # sync's received */ | 321 | _u16 num_sync_rqst; /* 0x5A # sync requests */ |
325 | _u16 num_sync_rqst; /* 0x5A # sync requests */ | 322 | _u16 num_tx; /* 0x5C Num pkts sent */ |
326 | _u16 num_tx; /* 0x5C Num pkts sent */ | 323 | _u16 num_rx; /* 0x5E Num pkts received */ |
327 | _u16 num_rx; /* 0x5E Num pkts received */ | 324 | _u16 module_attached; /* 0x60 Module tpyes of attached */ |
328 | _u16 module_attached; /* 0x60 Module tpyes of attached */ | 325 | _u16 led_timeout; /* 0x62 LED timeout */ |
329 | _u16 led_timeout; /* 0x62 LED timeout */ | 326 | _u16 first_port; /* 0x64 First port to service */ |
330 | _u16 first_port; /* 0x64 First port to service */ | 327 | _u16 last_port; /* 0x66 Last port to service */ |
331 | _u16 last_port; /* 0x66 Last port to service */ | ||
332 | 328 | ||
333 | } LPB; | 329 | } LPB; |
334 | 330 | ||
335 | /* Same thing again, but defined as offsets... */ | 331 | /* Same thing again, but defined as offsets... */ |
336 | 332 | ||
337 | #define LPB_link_number 0x00 /* 0x00 Link Number */ | 333 | #define LPB_link_number 0x00 /* 0x00 Link Number */ |
338 | #define LPB_in_ch 0x02 /* 0x02 Link In Channel */ | 334 | #define LPB_in_ch 0x02 /* 0x02 Link In Channel */ |
339 | #define LPB_out_ch 0x04 /* 0x04 Link Out Channel */ | 335 | #define LPB_out_ch 0x04 /* 0x04 Link Out Channel */ |
340 | #define LPB_attached_serial 0x06 /* 0x06 Attached serial number */ | 336 | #define LPB_attached_serial 0x06 /* 0x06 Attached serial number */ |
341 | #define LPB_attached_host_serial 0x0A /* 0x0A Serial number of Host who booted other end */ | 337 | #define LPB_attached_host_serial 0x0A /* 0x0A Serial number of Host who booted other end */ |
342 | #define LPB_descheduled 0x0E /* 0x0E Currently Descheduled */ | 338 | #define LPB_descheduled 0x0E /* 0x0E Currently Descheduled */ |
343 | #define LPB_state 0x10 /* 0x10 Current state */ | 339 | #define LPB_state 0x10 /* 0x10 Current state */ |
344 | #define LPB_send_poll 0x12 /* 0x12 Send a Poll Packet */ | 340 | #define LPB_send_poll 0x12 /* 0x12 Send a Poll Packet */ |
345 | #define LPB_ltt_p 0x14 /* 0x14 Process Descriptor */ | 341 | #define LPB_ltt_p 0x14 /* 0x14 Process Descriptor */ |
346 | #define LPB_lrt_p 0x16 /* 0x16 Process Descriptor */ | 342 | #define LPB_lrt_p 0x16 /* 0x16 Process Descriptor */ |
347 | #define LPB_lrt_status 0x18 /* 0x18 Current lrt status */ | 343 | #define LPB_lrt_status 0x18 /* 0x18 Current lrt status */ |
348 | #define LPB_ltt_status 0x1A /* 0x1A Current ltt status */ | 344 | #define LPB_ltt_status 0x1A /* 0x1A Current ltt status */ |
349 | #define LPB_timeout 0x1C /* 0x1C Timeout value */ | 345 | #define LPB_timeout 0x1C /* 0x1C Timeout value */ |
350 | #define LPB_topology 0x1E /* 0x1E Topology bits */ | 346 | #define LPB_topology 0x1E /* 0x1E Topology bits */ |
351 | #define LPB_mon_ltt 0x20 /* 0x20 */ | 347 | #define LPB_mon_ltt 0x20 /* 0x20 */ |
352 | #define LPB_mon_lrt 0x22 /* 0x22 */ | 348 | #define LPB_mon_lrt 0x22 /* 0x22 */ |
353 | #define LPB_num_pkts 0x24 /* 0x24 */ | 349 | #define LPB_num_pkts 0x24 /* 0x24 */ |
354 | #define LPB_add_packet_list 0x26 /* 0x26 Add packets to here */ | 350 | #define LPB_add_packet_list 0x26 /* 0x26 Add packets to here */ |
355 | #define LPB_remove_packet_list 0x28 /* 0x28 Send packets from here */ | 351 | #define LPB_remove_packet_list 0x28 /* 0x28 Send packets from here */ |
356 | #define LPB_lrt_fail_chan 0x2A /* 0x2A Lrt's failure channel */ | 352 | #define LPB_lrt_fail_chan 0x2A /* 0x2A Lrt's failure channel */ |
357 | #define LPB_ltt_fail_chan 0x2C /* 0x2C Ltt's failure channel */ | 353 | #define LPB_ltt_fail_chan 0x2C /* 0x2C Ltt's failure channel */ |
358 | #define LPB_rup 0x2E /* 0x2E RUP structure for HOST to driver comms */ | 354 | #define LPB_rup 0x2E /* 0x2E RUP structure for HOST to driver comms */ |
359 | #define LPB_link_rup 0x40 /* 0x40 RUP for the link (POLL, topology etc.) */ | 355 | #define LPB_link_rup 0x40 /* 0x40 RUP for the link (POLL, topology etc.) */ |
360 | #define LPB_attached_link 0x52 /* 0x52 Number of attached link */ | 356 | #define LPB_attached_link 0x52 /* 0x52 Number of attached link */ |
361 | #define LPB_csum_errors 0x54 /* 0x54 csum errors */ | 357 | #define LPB_csum_errors 0x54 /* 0x54 csum errors */ |
362 | #define LPB_num_disconnects 0x56 /* 0x56 number of disconnects */ | 358 | #define LPB_num_disconnects 0x56 /* 0x56 number of disconnects */ |
363 | #define LPB_num_sync_rcvd 0x58 /* 0x58 # sync's received */ | 359 | #define LPB_num_sync_rcvd 0x58 /* 0x58 # sync's received */ |
364 | #define LPB_num_sync_rqst 0x5A /* 0x5A # sync requests */ | 360 | #define LPB_num_sync_rqst 0x5A /* 0x5A # sync requests */ |
365 | #define LPB_num_tx 0x5C /* 0x5C Num pkts sent */ | 361 | #define LPB_num_tx 0x5C /* 0x5C Num pkts sent */ |
366 | #define LPB_num_rx 0x5E /* 0x5E Num pkts received */ | 362 | #define LPB_num_rx 0x5E /* 0x5E Num pkts received */ |
367 | #define LPB_module_attached 0x60 /* 0x60 Module tpyes of attached */ | 363 | #define LPB_module_attached 0x60 /* 0x60 Module tpyes of attached */ |
368 | #define LPB_led_timeout 0x62 /* 0x62 LED timeout */ | 364 | #define LPB_led_timeout 0x62 /* 0x62 LED timeout */ |
369 | #define LPB_first_port 0x64 /* 0x64 First port to service */ | 365 | #define LPB_first_port 0x64 /* 0x64 First port to service */ |
370 | #define LPB_last_port 0x66 /* 0x66 Last port to service */ | 366 | #define LPB_last_port 0x66 /* 0x66 Last port to service */ |
371 | #define sizeof_LPB 0x68 /* structure size = 0x68 */ | 367 | #define sizeof_LPB 0x68 /* structure size = 0x68 */ |
372 | 368 | ||
373 | #define LINKS_PER_UNIT 4 /* number of links from a host */ | 369 | #define LINKS_PER_UNIT 4 /* number of links from a host */ |
374 | 370 | ||
375 | /***************************************************************************** | 371 | /***************************************************************************** |
376 | ******************************** ******************************* | 372 | ******************************** ******************************* |
@@ -380,17 +376,16 @@ typedef struct _LPB | |||
380 | 376 | ||
381 | /* Used to overlay packet headers when allocating/freeing packets from the free list */ | 377 | /* Used to overlay packet headers when allocating/freeing packets from the free list */ |
382 | 378 | ||
383 | typedef struct _FREE_LIST | 379 | typedef struct _FREE_LIST { |
384 | { | 380 | _u16 next; /* 0x00 offset of next list item */ |
385 | _u16 next; /* 0x00 offset of next list item */ | 381 | _u16 prev; /* 0x02 offset of previous list item */ |
386 | _u16 prev; /* 0x02 offset of previous list item */ | ||
387 | 382 | ||
388 | } FREE_LIST; | 383 | } FREE_LIST; |
389 | 384 | ||
390 | /* Same thing again, but defined as offsets... */ | 385 | /* Same thing again, but defined as offsets... */ |
391 | 386 | ||
392 | #define FL_next 0x00 /* 0x00 offset of next list item */ | 387 | #define FL_next 0x00 /* 0x00 offset of next list item */ |
393 | #define FL_prev 0x02 /* 0x02 offset of previous list item */ | 388 | #define FL_prev 0x02 /* 0x02 offset of previous list item */ |
394 | 389 | ||
395 | /***************************************************************************** | 390 | /***************************************************************************** |
396 | ********************************** *********************************** | 391 | ********************************** *********************************** |
@@ -401,32 +396,31 @@ typedef struct _FREE_LIST | |||
401 | /* The PKT is the main unit of communication between Host Cards and RTAs across | 396 | /* The PKT is the main unit of communication between Host Cards and RTAs across |
402 | the RIO network. */ | 397 | the RIO network. */ |
403 | 398 | ||
404 | #define PKT_MAX_DATA_LEN 72 /* Size of packet data */ | 399 | #define PKT_MAX_DATA_LEN 72 /* Size of packet data */ |
405 | 400 | ||
406 | typedef struct _PKT | 401 | typedef struct _PKT { |
407 | { | 402 | _u8 dest_unit; /* 0x00 Destination Unit Id */ |
408 | _u8 dest_unit; /* 0x00 Destination Unit Id */ | 403 | _u8 dest_port; /* 0x01 Destination Port */ |
409 | _u8 dest_port; /* 0x01 Destination Port */ | 404 | _u8 src_unit; /* 0x02 Source Unit Id */ |
410 | _u8 src_unit; /* 0x02 Source Unit Id */ | 405 | _u8 src_port; /* 0x03 Source Port */ |
411 | _u8 src_port; /* 0x03 Source Port */ | 406 | _u8 len; /* 0x04 Length (in bytes) of data field */ |
412 | _u8 len; /* 0x04 Length (in bytes) of data field */ | 407 | _u8 control; /* 0x05 */ |
413 | _u8 control; /* 0x05 */ | 408 | _u8 data[PKT_MAX_DATA_LEN]; /* 0x06 Actual data */ |
414 | _u8 data[PKT_MAX_DATA_LEN]; /* 0x06 Actual data */ | 409 | _u16 csum; /* 0x4E C-SUM */ |
415 | _u16 csum; /* 0x4E C-SUM */ | ||
416 | 410 | ||
417 | } PKT; | 411 | } PKT; |
418 | 412 | ||
419 | /* Same thing again, but defined as offsets... */ | 413 | /* Same thing again, but defined as offsets... */ |
420 | 414 | ||
421 | #define PKT_dest_unit 0x00 /* 0x00 Destination Unit Id */ | 415 | #define PKT_dest_unit 0x00 /* 0x00 Destination Unit Id */ |
422 | #define PKT_dest_port 0x01 /* 0x01 Destination Port */ | 416 | #define PKT_dest_port 0x01 /* 0x01 Destination Port */ |
423 | #define PKT_src_unit 0x02 /* 0x02 Source Unit Id */ | 417 | #define PKT_src_unit 0x02 /* 0x02 Source Unit Id */ |
424 | #define PKT_src_port 0x03 /* 0x03 Source Port */ | 418 | #define PKT_src_port 0x03 /* 0x03 Source Port */ |
425 | #define PKT_len 0x04 /* 0x04 Length (in bytes) of data field */ | 419 | #define PKT_len 0x04 /* 0x04 Length (in bytes) of data field */ |
426 | #define PKT_control 0x05 /* 0x05 */ | 420 | #define PKT_control 0x05 /* 0x05 */ |
427 | #define PKT_data 0x06 /* 0x06 Actual data */ | 421 | #define PKT_data 0x06 /* 0x06 Actual data */ |
428 | #define PKT_csum 0x4E /* 0x4E C-SUM */ | 422 | #define PKT_csum 0x4E /* 0x4E C-SUM */ |
429 | #define sizeof_PKT 0x50 /* structure size = 0x50 */ | 423 | #define sizeof_PKT 0x50 /* structure size = 0x50 */ |
430 | 424 | ||
431 | /* PKT.len definitions... */ | 425 | /* PKT.len definitions... */ |
432 | #define PKT_CMD_BIT 0x80 | 426 | #define PKT_CMD_BIT 0x80 |
@@ -449,38 +443,38 @@ typedef struct _PKT | |||
449 | /* The following definitions and structures define the control packets sent | 443 | /* The following definitions and structures define the control packets sent |
450 | between the driver and RIO Ports, RTAs and Host Cards. */ | 444 | between the driver and RIO Ports, RTAs and Host Cards. */ |
451 | 445 | ||
452 | #define PRE_EMPTIVE 0x80 /* Pre-emptive command (sent via port's RUP) */ | 446 | #define PRE_EMPTIVE 0x80 /* Pre-emptive command (sent via port's RUP) */ |
453 | 447 | ||
454 | /* "in-band" and "pre-emptive" port commands... */ | 448 | /* "in-band" and "pre-emptive" port commands... */ |
455 | #define OPEN 0x00 /* Driver->RIO Open a port */ | 449 | #define OPEN 0x00 /* Driver->RIO Open a port */ |
456 | #define CONFIG 0x01 /* Driver->RIO Configure a port */ | 450 | #define CONFIG 0x01 /* Driver->RIO Configure a port */ |
457 | #define MOPEN 0x02 /* Driver->RIO Modem open (wait for DCD) */ | 451 | #define MOPEN 0x02 /* Driver->RIO Modem open (wait for DCD) */ |
458 | #define CLOSE 0x03 /* Driver->RIO Close a port */ | 452 | #define CLOSE 0x03 /* Driver->RIO Close a port */ |
459 | #define WFLUSH (0x04|PRE_EMPTIVE) /* Driver->RIO Write flush */ | 453 | #define WFLUSH (0x04|PRE_EMPTIVE) /* Driver->RIO Write flush */ |
460 | #define RFLUSH (0x05|PRE_EMPTIVE) /* Driver->RIO Read flush */ | 454 | #define RFLUSH (0x05|PRE_EMPTIVE) /* Driver->RIO Read flush */ |
461 | #define RESUME (0x06|PRE_EMPTIVE) /* Driver->RIO Behave as if XON received */ | 455 | #define RESUME (0x06|PRE_EMPTIVE) /* Driver->RIO Behave as if XON received */ |
462 | #define SBREAK 0x07 /* Driver->RIO Start break */ | 456 | #define SBREAK 0x07 /* Driver->RIO Start break */ |
463 | #define EBREAK 0x08 /* Driver->RIO End break */ | 457 | #define EBREAK 0x08 /* Driver->RIO End break */ |
464 | #define SUSPEND (0x09|PRE_EMPTIVE) /* Driver->RIO Behave as if XOFF received */ | 458 | #define SUSPEND (0x09|PRE_EMPTIVE) /* Driver->RIO Behave as if XOFF received */ |
465 | #define FCLOSE (0x0A|PRE_EMPTIVE) /* Driver->RIO Force close */ | 459 | #define FCLOSE (0x0A|PRE_EMPTIVE) /* Driver->RIO Force close */ |
466 | #define XPRINT 0x0B /* Driver->RIO Xprint packet */ | 460 | #define XPRINT 0x0B /* Driver->RIO Xprint packet */ |
467 | #define MBIS (0x0C|PRE_EMPTIVE) /* Driver->RIO Set modem lines */ | 461 | #define MBIS (0x0C|PRE_EMPTIVE) /* Driver->RIO Set modem lines */ |
468 | #define MBIC (0x0D|PRE_EMPTIVE) /* Driver->RIO Clear modem lines */ | 462 | #define MBIC (0x0D|PRE_EMPTIVE) /* Driver->RIO Clear modem lines */ |
469 | #define MSET (0x0E|PRE_EMPTIVE) /* Driver->RIO Set modem lines */ | 463 | #define MSET (0x0E|PRE_EMPTIVE) /* Driver->RIO Set modem lines */ |
470 | #define PCLOSE 0x0F /* Driver->RIO Pseudo close */ | 464 | #define PCLOSE 0x0F /* Driver->RIO Pseudo close */ |
471 | #define MGET (0x10|PRE_EMPTIVE) /* Driver->RIO Force update of modem status */ | 465 | #define MGET (0x10|PRE_EMPTIVE) /* Driver->RIO Force update of modem status */ |
472 | #define MEMDUMP (0x11|PRE_EMPTIVE) /* Driver->RIO DEBUG request for RTA memory */ | 466 | #define MEMDUMP (0x11|PRE_EMPTIVE) /* Driver->RIO DEBUG request for RTA memory */ |
473 | #define READ_REGISTER (0x12|PRE_EMPTIVE) /* Driver->RIO DEBUG read CD1400 register */ | 467 | #define READ_REGISTER (0x12|PRE_EMPTIVE) /* Driver->RIO DEBUG read CD1400 register */ |
474 | 468 | ||
475 | /* Remote Unit Port (RUP) packet definitions... (specified in PKT.dest_unit and PKT.src_unit) */ | 469 | /* Remote Unit Port (RUP) packet definitions... (specified in PKT.dest_unit and PKT.src_unit) */ |
476 | #define SYNC_RUP 0xFF /* Download internal */ | 470 | #define SYNC_RUP 0xFF /* Download internal */ |
477 | #define COMMAND_RUP 0xFE /* Command ack/status */ | 471 | #define COMMAND_RUP 0xFE /* Command ack/status */ |
478 | #define ERROR_RUP 0xFD /* Download internal */ | 472 | #define ERROR_RUP 0xFD /* Download internal */ |
479 | #define POLL_RUP 0xFC /* Download internal */ | 473 | #define POLL_RUP 0xFC /* Download internal */ |
480 | #define BOOT_RUP 0xFB /* Used to boot RTAs */ | 474 | #define BOOT_RUP 0xFB /* Used to boot RTAs */ |
481 | #define ROUTE_RUP 0xFA /* Used to specify routing/topology */ | 475 | #define ROUTE_RUP 0xFA /* Used to specify routing/topology */ |
482 | #define STATUS_RUP 0xF9 /* Not used */ | 476 | #define STATUS_RUP 0xF9 /* Not used */ |
483 | #define POWER_RUP 0xF8 /* Download internal */ | 477 | #define POWER_RUP 0xF8 /* Download internal */ |
484 | 478 | ||
485 | /* COMMAND_RUP definitions... */ | 479 | /* COMMAND_RUP definitions... */ |
486 | #define COMPLETE (0x20|PRE_EMPTIVE) /* RIO->Driver Command complete */ | 480 | #define COMPLETE (0x20|PRE_EMPTIVE) /* RIO->Driver Command complete */ |
@@ -488,24 +482,24 @@ typedef struct _PKT | |||
488 | #define MODEM_STATUS (0x22|PRE_EMPTIVE) /* RIO->Driver Modem status change */ | 482 | #define MODEM_STATUS (0x22|PRE_EMPTIVE) /* RIO->Driver Modem status change */ |
489 | 483 | ||
490 | /* BOOT_RUP definitions... */ | 484 | /* BOOT_RUP definitions... */ |
491 | #define BOOT_REQUEST 0x00 /* RIO->Driver Request for boot */ | 485 | #define BOOT_REQUEST 0x00 /* RIO->Driver Request for boot */ |
492 | #define BOOT_ABORT 0x01 /* Driver->RIO Abort a boot */ | 486 | #define BOOT_ABORT 0x01 /* Driver->RIO Abort a boot */ |
493 | #define BOOT_SEQUENCE 0x02 /* Driver->RIO Packet with firmware details */ | 487 | #define BOOT_SEQUENCE 0x02 /* Driver->RIO Packet with firmware details */ |
494 | #define BOOT_COMPLETED 0x03 /* RIO->Driver Boot completed */ | 488 | #define BOOT_COMPLETED 0x03 /* RIO->Driver Boot completed */ |
495 | #define IFOAD 0x2F /* Driver->RIO Shutdown/Reboot RTA (Fall Over And Die) */ | 489 | #define IFOAD 0x2F /* Driver->RIO Shutdown/Reboot RTA (Fall Over And Die) */ |
496 | #define IDENTIFY 0x30 /* Driver->RIO Identify RTA */ | 490 | #define IDENTIFY 0x30 /* Driver->RIO Identify RTA */ |
497 | #define ZOMBIE 0x31 /* Driver->RIO Shutdown/Flash LEDs */ | 491 | #define ZOMBIE 0x31 /* Driver->RIO Shutdown/Flash LEDs */ |
498 | #define UFOAD 0x32 /* Driver->RIO Shutdown/Reboot neighbouring RTA */ | 492 | #define UFOAD 0x32 /* Driver->RIO Shutdown/Reboot neighbouring RTA */ |
499 | #define IWAIT 0x33 /* Driver->RIO Pause booting process */ | 493 | #define IWAIT 0x33 /* Driver->RIO Pause booting process */ |
500 | 494 | ||
501 | /* ROUTE_RUP definitions... */ | 495 | /* ROUTE_RUP definitions... */ |
502 | #define ROUTE_REQUEST 0x00 /* RIO->Driver Request an ID */ | 496 | #define ROUTE_REQUEST 0x00 /* RIO->Driver Request an ID */ |
503 | #define ROUTE_FOAD 0x01 /* Driver->RIO Shutdown/reboot RTA */ | 497 | #define ROUTE_FOAD 0x01 /* Driver->RIO Shutdown/reboot RTA */ |
504 | #define ROUTE_ALREADY 0x02 /* Driver->RIO Not used */ | 498 | #define ROUTE_ALREADY 0x02 /* Driver->RIO Not used */ |
505 | #define ROUTE_USED 0x03 /* Driver->RIO Not used */ | 499 | #define ROUTE_USED 0x03 /* Driver->RIO Not used */ |
506 | #define ROUTE_ALLOCATE 0x04 /* Driver->RIO Allocate RTA RUP numbers */ | 500 | #define ROUTE_ALLOCATE 0x04 /* Driver->RIO Allocate RTA RUP numbers */ |
507 | #define ROUTE_REQ_TOP 0x05 /* Driver->RIO Not used */ | 501 | #define ROUTE_REQ_TOP 0x05 /* Driver->RIO Not used */ |
508 | #define ROUTE_TOPOLOGY 0x06 /* RIO->Driver Route/Topology status */ | 502 | #define ROUTE_TOPOLOGY 0x06 /* RIO->Driver Route/Topology status */ |
509 | 503 | ||
510 | /***************************************************************************** | 504 | /***************************************************************************** |
511 | ********************************** ********************************** | 505 | ********************************** ********************************** |
@@ -518,89 +512,89 @@ typedef struct _PKT | |||
518 | Sent to open a port. | 512 | Sent to open a port. |
519 | Structure of configuration info used with OPEN, CONFIG and MOPEN packets... */ | 513 | Structure of configuration info used with OPEN, CONFIG and MOPEN packets... */ |
520 | 514 | ||
521 | #define PKT_Cmd (PKT_Data+0) /* Command code */ | 515 | #define PKT_Cmd (PKT_Data+0) /* Command code */ |
522 | #define PKT_Cor1 (PKT_Data+1) /* Channel Option Register 1 */ | 516 | #define PKT_Cor1 (PKT_Data+1) /* Channel Option Register 1 */ |
523 | #define PKT_Cor2 (PKT_Data+2) /* Channel Option Register 2 */ | 517 | #define PKT_Cor2 (PKT_Data+2) /* Channel Option Register 2 */ |
524 | #define PKT_Cor4 (PKT_Data+3) /* Channel Option Register 4 */ | 518 | #define PKT_Cor4 (PKT_Data+3) /* Channel Option Register 4 */ |
525 | #define PKT_Cor5 (PKT_Data+4) /* Channel Option Register 5 */ | 519 | #define PKT_Cor5 (PKT_Data+4) /* Channel Option Register 5 */ |
526 | #define PKT_TxXon (PKT_Data+5) /* Transmit XON character */ | 520 | #define PKT_TxXon (PKT_Data+5) /* Transmit XON character */ |
527 | #define PKT_TxXoff (PKT_Data+6) /* Transmit XOFF character */ | 521 | #define PKT_TxXoff (PKT_Data+6) /* Transmit XOFF character */ |
528 | #define PKT_RxXon (PKT_Data+7) /* Receive XON character */ | 522 | #define PKT_RxXon (PKT_Data+7) /* Receive XON character */ |
529 | #define PKT_RxXoff (PKT_Data+8) /* Receive XOFF character */ | 523 | #define PKT_RxXoff (PKT_Data+8) /* Receive XOFF character */ |
530 | #define PKT_Lnext (PKT_Data+9) /* Lnext character */ | 524 | #define PKT_Lnext (PKT_Data+9) /* Lnext character */ |
531 | #define PKT_TxBaud (PKT_Data+10) /* Transmit baud rate */ | 525 | #define PKT_TxBaud (PKT_Data+10) /* Transmit baud rate */ |
532 | #define PKT_RxBaud (PKT_Data+11) /* Receive baud rate */ | 526 | #define PKT_RxBaud (PKT_Data+11) /* Receive baud rate */ |
533 | 527 | ||
534 | /* COR1 definitions... */ | 528 | /* COR1 definitions... */ |
535 | #define COR1_PARITY 0xE0 /* Parity mask */ | 529 | #define COR1_PARITY 0xE0 /* Parity mask */ |
536 | #define COR1_NONE 0x00 /* No parity */ | 530 | #define COR1_NONE 0x00 /* No parity */ |
537 | #define COR1_SPACE 0x20 /* Space parity */ | 531 | #define COR1_SPACE 0x20 /* Space parity */ |
538 | #define COR1_EVEN 0x40 /* Even parity */ | 532 | #define COR1_EVEN 0x40 /* Even parity */ |
539 | #define COR1_MARK 0xA0 /* Mark parity */ | 533 | #define COR1_MARK 0xA0 /* Mark parity */ |
540 | #define COR1_ODD 0xC0 /* Odd parity */ | 534 | #define COR1_ODD 0xC0 /* Odd parity */ |
541 | 535 | ||
542 | #define COR1_STOPBITS 0x0C /* Stop bits mask */ | 536 | #define COR1_STOPBITS 0x0C /* Stop bits mask */ |
543 | #define COR1_STOP1 0x00 /* 1 stop bit */ | 537 | #define COR1_STOP1 0x00 /* 1 stop bit */ |
544 | #define COR1_STOP1_5 0x04 /* 1.5 stop bits */ | 538 | #define COR1_STOP1_5 0x04 /* 1.5 stop bits */ |
545 | #define COR1_STOP2 0x08 /* 2 stop bits */ | 539 | #define COR1_STOP2 0x08 /* 2 stop bits */ |
546 | 540 | ||
547 | #define COR1_DATABITS 0x03 /* Data bits mask */ | 541 | #define COR1_DATABITS 0x03 /* Data bits mask */ |
548 | #define COR1_DATA5 0x00 /* 5 data bits */ | 542 | #define COR1_DATA5 0x00 /* 5 data bits */ |
549 | #define COR1_DATA6 0x01 /* 6 data bits */ | 543 | #define COR1_DATA6 0x01 /* 6 data bits */ |
550 | #define COR1_DATA7 0x02 /* 7 data bits */ | 544 | #define COR1_DATA7 0x02 /* 7 data bits */ |
551 | #define COR1_DATA8 0x03 /* 8 data bits */ | 545 | #define COR1_DATA8 0x03 /* 8 data bits */ |
552 | 546 | ||
553 | /* COR2 definitions... */ | 547 | /* COR2 definitions... */ |
554 | #define COR2_XON_TXFLOW 0x40 /* XON/XOFF Transmit Flow */ | 548 | #define COR2_XON_TXFLOW 0x40 /* XON/XOFF Transmit Flow */ |
555 | #define COR2_XANY_TXFLOW 0xC0 /* XON/XANY Transmit Flow */ | 549 | #define COR2_XANY_TXFLOW 0xC0 /* XON/XANY Transmit Flow */ |
556 | #define COR2_HUPCL 0x20 /* Hang Up On Close */ | 550 | #define COR2_HUPCL 0x20 /* Hang Up On Close */ |
557 | #define COR2_DSR_TXFLOW 0x08 /* DSR Transmit Flow Control */ | 551 | #define COR2_DSR_TXFLOW 0x08 /* DSR Transmit Flow Control */ |
558 | #define COR2_RTS_RXFLOW 0x04 /* RTS Receive Flow Control */ | 552 | #define COR2_RTS_RXFLOW 0x04 /* RTS Receive Flow Control */ |
559 | #define COR2_CTS_TXFLOW 0x02 /* CTS Transmit Flow Control */ | 553 | #define COR2_CTS_TXFLOW 0x02 /* CTS Transmit Flow Control */ |
560 | #define COR2_XON_RXFLOW 0x01 /* XON/XOFF Receive Flow */ | 554 | #define COR2_XON_RXFLOW 0x01 /* XON/XOFF Receive Flow */ |
561 | 555 | ||
562 | /* COR4 definition... */ | 556 | /* COR4 definition... */ |
563 | #define COR4_IGNCR 0x80 /* Discard received CR */ | 557 | #define COR4_IGNCR 0x80 /* Discard received CR */ |
564 | #define COR4_ICRNL 0x40 /* Map received CR -> NL */ | 558 | #define COR4_ICRNL 0x40 /* Map received CR -> NL */ |
565 | #define COR4_INLCR 0x20 /* Map received NL -> CR */ | 559 | #define COR4_INLCR 0x20 /* Map received NL -> CR */ |
566 | #define COR4_IGNBRK 0x10 /* Ignore Received Break */ | 560 | #define COR4_IGNBRK 0x10 /* Ignore Received Break */ |
567 | #define COR4_NBRKINT 0x08 /* No interrupt on rx Break */ | 561 | #define COR4_NBRKINT 0x08 /* No interrupt on rx Break */ |
568 | #define COR4_IGNPAR 0x04 /* ignore rx parity error chars */ | 562 | #define COR4_IGNPAR 0x04 /* ignore rx parity error chars */ |
569 | #define COR4_PARMRK 0x02 /* Mark rx parity error chars */ | 563 | #define COR4_PARMRK 0x02 /* Mark rx parity error chars */ |
570 | #define COR4_RAISEMOD 0x01 /* Raise modem lines on !0 baud */ | 564 | #define COR4_RAISEMOD 0x01 /* Raise modem lines on !0 baud */ |
571 | 565 | ||
572 | /* COR5 definitions... */ | 566 | /* COR5 definitions... */ |
573 | #define COR5_ISTRIP 0x80 /* Strip input chars to 7 bits */ | 567 | #define COR5_ISTRIP 0x80 /* Strip input chars to 7 bits */ |
574 | #define COR5_LNE 0x40 /* Enable LNEXT processing */ | 568 | #define COR5_LNE 0x40 /* Enable LNEXT processing */ |
575 | #define COR5_CMOE 0x20 /* Match good & error characters */ | 569 | #define COR5_CMOE 0x20 /* Match good & error characters */ |
576 | #define COR5_TAB3 0x10 /* TAB3 mode */ | 570 | #define COR5_TAB3 0x10 /* TAB3 mode */ |
577 | #define COR5_TSTATE_ON 0x08 /* Enable tbusy/tstop monitoring */ | 571 | #define COR5_TSTATE_ON 0x08 /* Enable tbusy/tstop monitoring */ |
578 | #define COR5_TSTATE_OFF 0x04 /* Disable tbusy/tstop monitoring */ | 572 | #define COR5_TSTATE_OFF 0x04 /* Disable tbusy/tstop monitoring */ |
579 | #define COR5_ONLCR 0x02 /* NL -> CR NL on output */ | 573 | #define COR5_ONLCR 0x02 /* NL -> CR NL on output */ |
580 | #define COR5_OCRNL 0x01 /* CR -> NL on output */ | 574 | #define COR5_OCRNL 0x01 /* CR -> NL on output */ |
581 | 575 | ||
582 | /* RxBaud and TxBaud definitions... */ | 576 | /* RxBaud and TxBaud definitions... */ |
583 | #define RIO_B0 0x00 /* RTS / DTR signals dropped */ | 577 | #define RIO_B0 0x00 /* RTS / DTR signals dropped */ |
584 | #define RIO_B50 0x01 /* 50 baud */ | 578 | #define RIO_B50 0x01 /* 50 baud */ |
585 | #define RIO_B75 0x02 /* 75 baud */ | 579 | #define RIO_B75 0x02 /* 75 baud */ |
586 | #define RIO_B110 0x03 /* 110 baud */ | 580 | #define RIO_B110 0x03 /* 110 baud */ |
587 | #define RIO_B134 0x04 /* 134.5 baud */ | 581 | #define RIO_B134 0x04 /* 134.5 baud */ |
588 | #define RIO_B150 0x05 /* 150 baud */ | 582 | #define RIO_B150 0x05 /* 150 baud */ |
589 | #define RIO_B200 0x06 /* 200 baud */ | 583 | #define RIO_B200 0x06 /* 200 baud */ |
590 | #define RIO_B300 0x07 /* 300 baud */ | 584 | #define RIO_B300 0x07 /* 300 baud */ |
591 | #define RIO_B600 0x08 /* 600 baud */ | 585 | #define RIO_B600 0x08 /* 600 baud */ |
592 | #define RIO_B1200 0x09 /* 1200 baud */ | 586 | #define RIO_B1200 0x09 /* 1200 baud */ |
593 | #define RIO_B1800 0x0A /* 1800 baud */ | 587 | #define RIO_B1800 0x0A /* 1800 baud */ |
594 | #define RIO_B2400 0x0B /* 2400 baud */ | 588 | #define RIO_B2400 0x0B /* 2400 baud */ |
595 | #define RIO_B4800 0x0C /* 4800 baud */ | 589 | #define RIO_B4800 0x0C /* 4800 baud */ |
596 | #define RIO_B9600 0x0D /* 9600 baud */ | 590 | #define RIO_B9600 0x0D /* 9600 baud */ |
597 | #define RIO_B19200 0x0E /* 19200 baud */ | 591 | #define RIO_B19200 0x0E /* 19200 baud */ |
598 | #define RIO_B38400 0x0F /* 38400 baud */ | 592 | #define RIO_B38400 0x0F /* 38400 baud */ |
599 | #define RIO_B56000 0x10 /* 56000 baud */ | 593 | #define RIO_B56000 0x10 /* 56000 baud */ |
600 | #define RIO_B57600 0x11 /* 57600 baud */ | 594 | #define RIO_B57600 0x11 /* 57600 baud */ |
601 | #define RIO_B64000 0x12 /* 64000 baud */ | 595 | #define RIO_B64000 0x12 /* 64000 baud */ |
602 | #define RIO_B115200 0x13 /* 115200 baud */ | 596 | #define RIO_B115200 0x13 /* 115200 baud */ |
603 | #define RIO_B2000 0x14 /* 2000 baud */ | 597 | #define RIO_B2000 0x14 /* 2000 baud */ |
604 | 598 | ||
605 | /***************************************************************************** | 599 | /***************************************************************************** |
606 | ********************************* ********************************* | 600 | ********************************* ********************************* |
@@ -636,7 +630,7 @@ typedef struct _PKT | |||
636 | No parameters. | 630 | No parameters. |
637 | */ | 631 | */ |
638 | #if 0 | 632 | #if 0 |
639 | #define PKT_Cmd (PKT_Data+0) /* Command code */ | 633 | #define PKT_Cmd (PKT_Data+0) /* Command code */ |
640 | #endif | 634 | #endif |
641 | /***************************************************************************** | 635 | /***************************************************************************** |
642 | ********************************* ********************************* | 636 | ********************************* ********************************* |
@@ -653,9 +647,9 @@ typedef struct _PKT | |||
653 | write flushing previously started by a pre-emptive WFLUSH packet. (in-band) | 647 | write flushing previously started by a pre-emptive WFLUSH packet. (in-band) |
654 | */ | 648 | */ |
655 | #if 0 | 649 | #if 0 |
656 | #define PKT_Cmd (PKT_Data+0) /* Command code */ | 650 | #define PKT_Cmd (PKT_Data+0) /* Command code */ |
657 | #endif | 651 | #endif |
658 | #define PKT_PhbNum (PKT_Data+1) /* Port number wrt RTA */ | 652 | #define PKT_PhbNum (PKT_Data+1) /* Port number wrt RTA */ |
659 | 653 | ||
660 | /***************************************************************************** | 654 | /***************************************************************************** |
661 | ********************************* ********************************* | 655 | ********************************* ********************************* |
@@ -669,8 +663,8 @@ typedef struct _PKT | |||
669 | packets of a port. | 663 | packets of a port. |
670 | */ | 664 | */ |
671 | #if 0 | 665 | #if 0 |
672 | #define PKT_Cmd (PKT_Data+0) /* Command code */ | 666 | #define PKT_Cmd (PKT_Data+0) /* Command code */ |
673 | #define PKT_PhbNum (PKT_Data+1) /* Port number wrt RTA */ | 667 | #define PKT_PhbNum (PKT_Data+1) /* Port number wrt RTA */ |
674 | #endif | 668 | #endif |
675 | 669 | ||
676 | /***************************************************************************** | 670 | /***************************************************************************** |
@@ -685,8 +679,8 @@ typedef struct _PKT | |||
685 | transmission of data if blocked by XOFF. (as if XON had been received) | 679 | transmission of data if blocked by XOFF. (as if XON had been received) |
686 | */ | 680 | */ |
687 | #if 0 | 681 | #if 0 |
688 | #define PKT_Cmd (PKT_Data+0) /* Command code */ | 682 | #define PKT_Cmd (PKT_Data+0) /* Command code */ |
689 | #define PKT_PhbNum (PKT_Data+1) /* Port number wrt RTA */ | 683 | #define PKT_PhbNum (PKT_Data+1) /* Port number wrt RTA */ |
690 | #endif | 684 | #endif |
691 | 685 | ||
692 | /***************************************************************************** | 686 | /***************************************************************************** |
@@ -707,9 +701,9 @@ typedef struct _PKT | |||
707 | specified number of mS. | 701 | specified number of mS. |
708 | */ | 702 | */ |
709 | #if 0 | 703 | #if 0 |
710 | #define PKT_Cmd (PKT_Data+0) /* Command code */ | 704 | #define PKT_Cmd (PKT_Data+0) /* Command code */ |
711 | #endif | 705 | #endif |
712 | #define PKT_BreakDelay (PKT_Data+1) /* Break delay in mS */ | 706 | #define PKT_BreakDelay (PKT_Data+1) /* Break delay in mS */ |
713 | 707 | ||
714 | /***************************************************************************** | 708 | /***************************************************************************** |
715 | ********************************* ********************************* | 709 | ********************************* ********************************* |
@@ -736,8 +730,8 @@ typedef struct _PKT | |||
736 | transmission of data. (as if XOFF had been received) | 730 | transmission of data. (as if XOFF had been received) |
737 | */ | 731 | */ |
738 | #if 0 | 732 | #if 0 |
739 | #define PKT_Cmd (PKT_Data+0) /* Command code */ | 733 | #define PKT_Cmd (PKT_Data+0) /* Command code */ |
740 | #define PKT_PhbNum (PKT_Data+1) /* Port number wrt RTA */ | 734 | #define PKT_PhbNum (PKT_Data+1) /* Port number wrt RTA */ |
741 | #endif | 735 | #endif |
742 | 736 | ||
743 | /***************************************************************************** | 737 | /***************************************************************************** |
@@ -753,8 +747,8 @@ typedef struct _PKT | |||
753 | modem signals if the COR5_HUPCL (Hang Up On Close) flag is set. | 747 | modem signals if the COR5_HUPCL (Hang Up On Close) flag is set. |
754 | */ | 748 | */ |
755 | #if 0 | 749 | #if 0 |
756 | #define PKT_Cmd (PKT_Data+0) /* Command code */ | 750 | #define PKT_Cmd (PKT_Data+0) /* Command code */ |
757 | #define PKT_PhbNum (PKT_Data+1) /* Port number wrt RTA */ | 751 | #define PKT_PhbNum (PKT_Data+1) /* Port number wrt RTA */ |
758 | #endif | 752 | #endif |
759 | 753 | ||
760 | /***************************************************************************** | 754 | /***************************************************************************** |
@@ -774,8 +768,8 @@ typedef struct _PKT | |||
774 | - Transparent Print Stop Sequence. | 768 | - Transparent Print Stop Sequence. |
775 | */ | 769 | */ |
776 | #if 0 | 770 | #if 0 |
777 | #define PKT_Cmd (PKT_Data+0) /* Command code */ | 771 | #define PKT_Cmd (PKT_Data+0) /* Command code */ |
778 | #define PKT_PhbNum (PKT_Data+1) /* Port number wrt RTA */ | 772 | #define PKT_PhbNum (PKT_Data+1) /* Port number wrt RTA */ |
779 | #endif | 773 | #endif |
780 | 774 | ||
781 | /***************************************************************************** | 775 | /***************************************************************************** |
@@ -789,14 +783,14 @@ typedef struct _PKT | |||
789 | MBIS is sent pre-emptively from the driver to set a port's modem signals. | 783 | MBIS is sent pre-emptively from the driver to set a port's modem signals. |
790 | */ | 784 | */ |
791 | #if 0 | 785 | #if 0 |
792 | #define PKT_Cmd (PKT_Data+0) /* Command code */ | 786 | #define PKT_Cmd (PKT_Data+0) /* Command code */ |
793 | #define PKT_PhbNum (PKT_Data+1) /* Port number wrt RTA */ | 787 | #define PKT_PhbNum (PKT_Data+1) /* Port number wrt RTA */ |
794 | #endif | 788 | #endif |
795 | #define PKT_ModemSet (PKT_Data+4) /* Modem set signals mask */ | 789 | #define PKT_ModemSet (PKT_Data+4) /* Modem set signals mask */ |
796 | 790 | ||
797 | /* ModemSet definitions... */ | 791 | /* ModemSet definitions... */ |
798 | #define MBIS_RTS 0x01 /* RTS modem signal */ | 792 | #define MBIS_RTS 0x01 /* RTS modem signal */ |
799 | #define MBIS_DTR 0x02 /* DTR modem signal */ | 793 | #define MBIS_DTR 0x02 /* DTR modem signal */ |
800 | 794 | ||
801 | /***************************************************************************** | 795 | /***************************************************************************** |
802 | ********************************** ********************************** | 796 | ********************************** ********************************** |
@@ -808,16 +802,16 @@ typedef struct _PKT | |||
808 | 802 | ||
809 | MBIC is sent pre-emptively from the driver to clear a port's modem signals. | 803 | MBIC is sent pre-emptively from the driver to clear a port's modem signals. |
810 | */ | 804 | */ |
811 | #if 0 | 805 | #if 0 |
812 | #define PKT_Cmd (PKT_Data+0) /* Command code */ | 806 | #define PKT_Cmd (PKT_Data+0) /* Command code */ |
813 | #define PKT_PhbNum (PKT_Data+1) /* Port number wrt RTA */ | 807 | #define PKT_PhbNum (PKT_Data+1) /* Port number wrt RTA */ |
814 | #endif | 808 | #endif |
815 | 809 | ||
816 | #define PKT_ModemClear (PKT_Data+4) /* Modem clear signals mask */ | 810 | #define PKT_ModemClear (PKT_Data+4) /* Modem clear signals mask */ |
817 | 811 | ||
818 | /* ModemClear definitions... */ | 812 | /* ModemClear definitions... */ |
819 | #define MBIC_RTS 0x01 /* RTS modem signal */ | 813 | #define MBIC_RTS 0x01 /* RTS modem signal */ |
820 | #define MBIC_DTR 0x02 /* DTR modem signal */ | 814 | #define MBIC_DTR 0x02 /* DTR modem signal */ |
821 | 815 | ||
822 | /***************************************************************************** | 816 | /***************************************************************************** |
823 | ********************************** ********************************** | 817 | ********************************** ********************************** |
@@ -829,15 +823,15 @@ typedef struct _PKT | |||
829 | 823 | ||
830 | MSET is sent pre-emptively from the driver to set/clear a port's modem signals. */ | 824 | MSET is sent pre-emptively from the driver to set/clear a port's modem signals. */ |
831 | #if 0 | 825 | #if 0 |
832 | #define PKT_Cmd (PKT_Data+0) /* Command code */ | 826 | #define PKT_Cmd (PKT_Data+0) /* Command code */ |
833 | #define PKT_PhbNum (PKT_Data+1) /* Port number wrt RTA */ | 827 | #define PKT_PhbNum (PKT_Data+1) /* Port number wrt RTA */ |
834 | #endif | 828 | #endif |
835 | 829 | ||
836 | #define PKT_ModemSet (PKT_Data+4) /* Modem set signals mask */ | 830 | #define PKT_ModemSet (PKT_Data+4) /* Modem set signals mask */ |
837 | 831 | ||
838 | /* ModemSet definitions... */ | 832 | /* ModemSet definitions... */ |
839 | #define MSET_RTS 0x01 /* RTS modem signal */ | 833 | #define MSET_RTS 0x01 /* RTS modem signal */ |
840 | #define MSET_DTR 0x02 /* DTR modem signal */ | 834 | #define MSET_DTR 0x02 /* DTR modem signal */ |
841 | 835 | ||
842 | /***************************************************************************** | 836 | /***************************************************************************** |
843 | ********************************* ********************************* | 837 | ********************************* ********************************* |
@@ -853,7 +847,7 @@ typedef struct _PKT | |||
853 | port's transmit / receive and modem signals will be left enabled and the | 847 | port's transmit / receive and modem signals will be left enabled and the |
854 | port marked internally as Pseudo Closed. */ | 848 | port marked internally as Pseudo Closed. */ |
855 | 849 | ||
856 | #define PKT_Cmd (PKT_Data+0) /* Command code */ | 850 | #define PKT_Cmd (PKT_Data+0) /* Command code */ |
857 | 851 | ||
858 | /***************************************************************************** | 852 | /***************************************************************************** |
859 | ********************************** ********************************** | 853 | ********************************** ********************************** |
@@ -865,8 +859,8 @@ typedef struct _PKT | |||
865 | 859 | ||
866 | MGET is sent pre-emptively from the driver to request the port's current modem signals. */ | 860 | MGET is sent pre-emptively from the driver to request the port's current modem signals. */ |
867 | 861 | ||
868 | #define PKT_Cmd (PKT_Data+0) /* Command code */ | 862 | #define PKT_Cmd (PKT_Data+0) /* Command code */ |
869 | #define PKT_PhbNum (PKT_Data+1) /* Port number wrt RTA */ | 863 | #define PKT_PhbNum (PKT_Data+1) /* Port number wrt RTA */ |
870 | 864 | ||
871 | /***************************************************************************** | 865 | /***************************************************************************** |
872 | ********************************* ******************************** | 866 | ********************************* ******************************** |
@@ -880,11 +874,11 @@ typedef struct _PKT | |||
880 | of the specified port's RTA address space. | 874 | of the specified port's RTA address space. |
881 | */ | 875 | */ |
882 | #if 0 | 876 | #if 0 |
883 | #define PKT_Cmd (PKT_Data+0) /* Command code */ | 877 | #define PKT_Cmd (PKT_Data+0) /* Command code */ |
884 | #endif | 878 | #endif |
885 | #define PKT_PhbNum (PKT_Data+1) /* Port number wrt RTA */ | 879 | #define PKT_PhbNum (PKT_Data+1) /* Port number wrt RTA */ |
886 | #define PKT_SubCmd (PKT_Data+5) /* Sub Command */ | 880 | #define PKT_SubCmd (PKT_Data+5) /* Sub Command */ |
887 | #define PKT_Address (PKT_Data+6) /* Requested address */ | 881 | #define PKT_Address (PKT_Data+6) /* Requested address */ |
888 | 882 | ||
889 | /***************************************************************************** | 883 | /***************************************************************************** |
890 | ****************************** ***************************** | 884 | ****************************** ***************************** |
@@ -898,11 +892,11 @@ typedef struct _PKT | |||
898 | of the CD1400 register specified in address. | 892 | of the CD1400 register specified in address. |
899 | */ | 893 | */ |
900 | #if 0 | 894 | #if 0 |
901 | #define PKT_Cmd (PKT_Data+0) /* Command code */ | 895 | #define PKT_Cmd (PKT_Data+0) /* Command code */ |
902 | #endif | 896 | #endif |
903 | #define PKT_PhbNum (PKT_Data+1) /* Port number wrt RTA */ | 897 | #define PKT_PhbNum (PKT_Data+1) /* Port number wrt RTA */ |
904 | #define PKT_SubCmd (PKT_Data+5) /* Sub Command */ | 898 | #define PKT_SubCmd (PKT_Data+5) /* Sub Command */ |
905 | #define PKT_Address (PKT_Data+6) /* Requested address */ | 899 | #define PKT_Address (PKT_Data+6) /* Requested address */ |
906 | 900 | ||
907 | /***************************************************************************** | 901 | /***************************************************************************** |
908 | ************************ ************************** | 902 | ************************ ************************** |
@@ -916,33 +910,33 @@ typedef struct _PKT | |||
916 | packets, except MEMDUMP and READ_REGISTER. | 910 | packets, except MEMDUMP and READ_REGISTER. |
917 | */ | 911 | */ |
918 | #if 0 | 912 | #if 0 |
919 | #define PKT_Cmd (PKT_Data+0) /* Command code */ | 913 | #define PKT_Cmd (PKT_Data+0) /* Command code */ |
920 | #endif | 914 | #endif |
921 | #define PKT_PhbNum (PKT_Data+1) /* Port number wrt RTA */ | 915 | #define PKT_PhbNum (PKT_Data+1) /* Port number wrt RTA */ |
922 | #define PKT_Cmd2 (PKT_Data+2) /* Command code copy */ | 916 | #define PKT_Cmd2 (PKT_Data+2) /* Command code copy */ |
923 | #define PKT_ModemStatus (PKT_Data+3) /* Modem signal status */ | 917 | #define PKT_ModemStatus (PKT_Data+3) /* Modem signal status */ |
924 | #define PKT_PortStatus (PKT_Data+4) /* Port signal status */ | 918 | #define PKT_PortStatus (PKT_Data+4) /* Port signal status */ |
925 | #define PKT_SubCmd (PKT_Data+5) /* Sub Command */ | 919 | #define PKT_SubCmd (PKT_Data+5) /* Sub Command */ |
926 | 920 | ||
927 | /* ModemStatus definitions... */ | 921 | /* ModemStatus definitions... */ |
928 | #define MODEM_DSR 0x80 /* Data Set Ready modem state */ | 922 | #define MODEM_DSR 0x80 /* Data Set Ready modem state */ |
929 | #define MODEM_CTS 0x40 /* Clear To Send modem state */ | 923 | #define MODEM_CTS 0x40 /* Clear To Send modem state */ |
930 | #define MODEM_RI 0x20 /* Ring Indicate modem state */ | 924 | #define MODEM_RI 0x20 /* Ring Indicate modem state */ |
931 | #define MODEM_CD 0x10 /* Carrier Detect modem state */ | 925 | #define MODEM_CD 0x10 /* Carrier Detect modem state */ |
932 | #define MODEM_TSTOP 0x08 /* Transmit Stopped state */ | 926 | #define MODEM_TSTOP 0x08 /* Transmit Stopped state */ |
933 | #define MODEM_TEMPTY 0x04 /* Transmit Empty state */ | 927 | #define MODEM_TEMPTY 0x04 /* Transmit Empty state */ |
934 | #define MODEM_DTR 0x02 /* DTR modem output state */ | 928 | #define MODEM_DTR 0x02 /* DTR modem output state */ |
935 | #define MODEM_RTS 0x01 /* RTS modem output state */ | 929 | #define MODEM_RTS 0x01 /* RTS modem output state */ |
936 | 930 | ||
937 | /* PortStatus definitions... */ | 931 | /* PortStatus definitions... */ |
938 | #define PORT_ISOPEN 0x01 /* Port open ? */ | 932 | #define PORT_ISOPEN 0x01 /* Port open ? */ |
939 | #define PORT_HUPCL 0x02 /* Hangup on close? */ | 933 | #define PORT_HUPCL 0x02 /* Hangup on close? */ |
940 | #define PORT_MOPENPEND 0x04 /* Modem open pending */ | 934 | #define PORT_MOPENPEND 0x04 /* Modem open pending */ |
941 | #define PORT_ISPARALLEL 0x08 /* Parallel port */ | 935 | #define PORT_ISPARALLEL 0x08 /* Parallel port */ |
942 | #define PORT_BREAK 0x10 /* Port on break */ | 936 | #define PORT_BREAK 0x10 /* Port on break */ |
943 | #define PORT_STATUSPEND 0020 /* Status packet pending */ | 937 | #define PORT_STATUSPEND 0020 /* Status packet pending */ |
944 | #define PORT_BREAKPEND 0x40 /* Break packet pending */ | 938 | #define PORT_BREAKPEND 0x40 /* Break packet pending */ |
945 | #define PORT_MODEMPEND 0x80 /* Modem status packet pending */ | 939 | #define PORT_MODEMPEND 0x80 /* Modem status packet pending */ |
946 | 940 | ||
947 | /***************************************************************************** | 941 | /***************************************************************************** |
948 | ************************ ************************** | 942 | ************************ ************************** |
@@ -956,35 +950,35 @@ typedef struct _PKT | |||
956 | packets, except MEMDUMP and READ_REGISTER. | 950 | packets, except MEMDUMP and READ_REGISTER. |
957 | */ | 951 | */ |
958 | #if 0 | 952 | #if 0 |
959 | #define PKT_Cmd (PKT_Data+0) /* Command code */ | 953 | #define PKT_Cmd (PKT_Data+0) /* Command code */ |
960 | #define PKT_PhbNum (PKT_Data+1) /* Port number wrt RTA */ | 954 | #define PKT_PhbNum (PKT_Data+1) /* Port number wrt RTA */ |
961 | #define PKT_Cmd2 (PKT_Data+2) /* Command code copy */ | 955 | #define PKT_Cmd2 (PKT_Data+2) /* Command code copy */ |
962 | #endif | 956 | #endif |
963 | #define PKT_ModemStatus (PKT_Data+3) /* Modem signal status */ | 957 | #define PKT_ModemStatus (PKT_Data+3) /* Modem signal status */ |
964 | #define PKT_PortStatus (PKT_Data+4) /* Port signal status */ | 958 | #define PKT_PortStatus (PKT_Data+4) /* Port signal status */ |
965 | #if 0 | 959 | #if 0 |
966 | #define PKT_SubCmd (PKT_Data+5) /* Sub Command */ | 960 | #define PKT_SubCmd (PKT_Data+5) /* Sub Command */ |
967 | #endif | 961 | #endif |
968 | 962 | ||
969 | /* ModemStatus definitions... */ | 963 | /* ModemStatus definitions... */ |
970 | #define MODEM_DSR 0x80 /* Data Set Ready modem state */ | 964 | #define MODEM_DSR 0x80 /* Data Set Ready modem state */ |
971 | #define MODEM_CTS 0x40 /* Clear To Send modem state */ | 965 | #define MODEM_CTS 0x40 /* Clear To Send modem state */ |
972 | #define MODEM_RI 0x20 /* Ring Indicate modem state */ | 966 | #define MODEM_RI 0x20 /* Ring Indicate modem state */ |
973 | #define MODEM_CD 0x10 /* Carrier Detect modem state */ | 967 | #define MODEM_CD 0x10 /* Carrier Detect modem state */ |
974 | #define MODEM_TSTOP 0x08 /* Transmit Stopped state */ | 968 | #define MODEM_TSTOP 0x08 /* Transmit Stopped state */ |
975 | #define MODEM_TEMPTY 0x04 /* Transmit Empty state */ | 969 | #define MODEM_TEMPTY 0x04 /* Transmit Empty state */ |
976 | #define MODEM_DTR 0x02 /* DTR modem output state */ | 970 | #define MODEM_DTR 0x02 /* DTR modem output state */ |
977 | #define MODEM_RTS 0x01 /* RTS modem output state */ | 971 | #define MODEM_RTS 0x01 /* RTS modem output state */ |
978 | 972 | ||
979 | /* PortStatus definitions... */ | 973 | /* PortStatus definitions... */ |
980 | #define PORT_ISOPEN 0x01 /* Port open ? */ | 974 | #define PORT_ISOPEN 0x01 /* Port open ? */ |
981 | #define PORT_HUPCL 0x02 /* Hangup on close? */ | 975 | #define PORT_HUPCL 0x02 /* Hangup on close? */ |
982 | #define PORT_MOPENPEND 0x04 /* Modem open pending */ | 976 | #define PORT_MOPENPEND 0x04 /* Modem open pending */ |
983 | #define PORT_ISPARALLEL 0x08 /* Parallel port */ | 977 | #define PORT_ISPARALLEL 0x08 /* Parallel port */ |
984 | #define PORT_BREAK 0x10 /* Port on break */ | 978 | #define PORT_BREAK 0x10 /* Port on break */ |
985 | #define PORT_STATUSPEND 0020 /* Status packet pending */ | 979 | #define PORT_STATUSPEND 0020 /* Status packet pending */ |
986 | #define PORT_BREAKPEND 0x40 /* Break packet pending */ | 980 | #define PORT_BREAKPEND 0x40 /* Break packet pending */ |
987 | #define PORT_MODEMPEND 0x80 /* Modem status packet pending */ | 981 | #define PORT_MODEMPEND 0x80 /* Modem status packet pending */ |
988 | 982 | ||
989 | /***************************************************************************** | 983 | /***************************************************************************** |
990 | ******************** ******************** | 984 | ******************** ******************** |
@@ -998,15 +992,15 @@ typedef struct _PKT | |||
998 | port I/O control command packet. | 992 | port I/O control command packet. |
999 | */ | 993 | */ |
1000 | #if 0 | 994 | #if 0 |
1001 | #define PKT_Cmd (PKT_Data+0) /* Command code */ | 995 | #define PKT_Cmd (PKT_Data+0) /* Command code */ |
1002 | #define PKT_PhbNum (PKT_Data+1) /* Port number wrt RTA */ | 996 | #define PKT_PhbNum (PKT_Data+1) /* Port number wrt RTA */ |
1003 | #define PKT_Cmd2 (PKT_Data+2) /* Command code copy */ | 997 | #define PKT_Cmd2 (PKT_Data+2) /* Command code copy */ |
1004 | #define PKT_ModemStatus (PKT_Data+3) /* Modem signal status */ | 998 | #define PKT_ModemStatus (PKT_Data+3) /* Modem signal status */ |
1005 | #define PKT_PortStatus (PKT_Data+4) /* Port signal status */ | 999 | #define PKT_PortStatus (PKT_Data+4) /* Port signal status */ |
1006 | #define PKT_SubCmd (PKT_Data+5) /* Sub Command */ | 1000 | #define PKT_SubCmd (PKT_Data+5) /* Sub Command */ |
1007 | #define PKT_Address (PKT_Data+6) /* Requested address */ | 1001 | #define PKT_Address (PKT_Data+6) /* Requested address */ |
1008 | #endif | 1002 | #endif |
1009 | #define PKT_Dump (PKT_Data+8) /* 32bytes of requested dump data */ | 1003 | #define PKT_Dump (PKT_Data+8) /* 32bytes of requested dump data */ |
1010 | 1004 | ||
1011 | /***************************************************************************** | 1005 | /***************************************************************************** |
1012 | ***************** ***************** | 1006 | ***************** ***************** |
@@ -1020,14 +1014,14 @@ typedef struct _PKT | |||
1020 | READ_REGISTER port I/O control command packet. | 1014 | READ_REGISTER port I/O control command packet. |
1021 | */ | 1015 | */ |
1022 | #if 0 | 1016 | #if 0 |
1023 | #define PKT_Cmd (PKT_Data+0) /*Command code */ | 1017 | #define PKT_Cmd (PKT_Data+0) /*Command code */ |
1024 | #define PKT_PhbNum (PKT_Data+1) /*Port number wrt RTA */ | 1018 | #define PKT_PhbNum (PKT_Data+1) /*Port number wrt RTA */ |
1025 | #define PKT_Cmd2 (PKT_Data+2) /* Command code copy */ | 1019 | #define PKT_Cmd2 (PKT_Data+2) /* Command code copy */ |
1026 | #endif | 1020 | #endif |
1027 | #define PKT_RegisterValue (PKT_Data+3) /* Modem signal status */ | 1021 | #define PKT_RegisterValue (PKT_Data+3) /* Modem signal status */ |
1028 | #if 0 | 1022 | #if 0 |
1029 | #define PKT_PortStatus (PKT_Data+4) /* Port signal status */ | 1023 | #define PKT_PortStatus (PKT_Data+4) /* Port signal status */ |
1030 | #define PKT_SubCmd (PKT_Data+5) /* Sub Command */ | 1024 | #define PKT_SubCmd (PKT_Data+5) /* Sub Command */ |
1031 | #endif | 1025 | #endif |
1032 | 1026 | ||
1033 | /***************************************************************************** | 1027 | /***************************************************************************** |
@@ -1041,9 +1035,9 @@ typedef struct _PKT | |||
1041 | COMMAND_RUP - BREAK_RECEIVED packets are sent when the port detects a receive BREAK signal. | 1035 | COMMAND_RUP - BREAK_RECEIVED packets are sent when the port detects a receive BREAK signal. |
1042 | */ | 1036 | */ |
1043 | #if 0 | 1037 | #if 0 |
1044 | #define PKT_Cmd (PKT_Data+0) /* Command code */ | 1038 | #define PKT_Cmd (PKT_Data+0) /* Command code */ |
1045 | #define PKT_PhbNum (PKT_Data+1) /* Port number wrt RTA */ | 1039 | #define PKT_PhbNum (PKT_Data+1) /* Port number wrt RTA */ |
1046 | #define PKT_Cmd2 (PKT_Data+2) /* Command code copy */ | 1040 | #define PKT_Cmd2 (PKT_Data+2) /* Command code copy */ |
1047 | #endif | 1041 | #endif |
1048 | 1042 | ||
1049 | /***************************************************************************** | 1043 | /***************************************************************************** |
@@ -1059,10 +1053,10 @@ typedef struct _PKT | |||
1059 | 1053 | ||
1060 | */ | 1054 | */ |
1061 | #if 0 | 1055 | #if 0 |
1062 | #define PKT_Cmd (PKT_Data+0) /* Command code */ | 1056 | #define PKT_Cmd (PKT_Data+0) /* Command code */ |
1063 | #define PKT_PhbNum (PKT_Data+1) /* Port number wrt RTA */ | 1057 | #define PKT_PhbNum (PKT_Data+1) /* Port number wrt RTA */ |
1064 | #define PKT_Cmd2 (PKT_Data+2) /* Command code copy */ | 1058 | #define PKT_Cmd2 (PKT_Data+2) /* Command code copy */ |
1065 | #define PKT_ModemStatus (PKT_Data+3) /* Modem signal status */ | 1059 | #define PKT_ModemStatus (PKT_Data+3) /* Modem signal status */ |
1066 | #endif | 1060 | #endif |
1067 | 1061 | ||
1068 | /***************************************************************************** | 1062 | /***************************************************************************** |
@@ -1077,7 +1071,7 @@ typedef struct _PKT | |||
1077 | firmware code to load onto attached RTAs. | 1071 | firmware code to load onto attached RTAs. |
1078 | */ | 1072 | */ |
1079 | #if 0 | 1073 | #if 0 |
1080 | #define PKT_Cmd (PKT_Data+0) /* Command code */ | 1074 | #define PKT_Cmd (PKT_Data+0) /* Command code */ |
1081 | #endif | 1075 | #endif |
1082 | 1076 | ||
1083 | /***************************************************************************** | 1077 | /***************************************************************************** |
@@ -1092,12 +1086,12 @@ typedef struct _PKT | |||
1092 | to a BOOT_RUP - BOOT_REQUEST packet. | 1086 | to a BOOT_RUP - BOOT_REQUEST packet. |
1093 | */ | 1087 | */ |
1094 | #if 0 | 1088 | #if 0 |
1095 | #define PKT_Cmd (PKT_Data+0) /* Command code */ | 1089 | #define PKT_Cmd (PKT_Data+0) /* Command code */ |
1096 | #endif | 1090 | #endif |
1097 | #define PKT_NumPackets (PKT_Data+2) /* Packets required to load firmware */ | 1091 | #define PKT_NumPackets (PKT_Data+2) /* Packets required to load firmware */ |
1098 | #define PKT_LoadBase (PKT_Data+4) /* RTA firmware load address */ | 1092 | #define PKT_LoadBase (PKT_Data+4) /* RTA firmware load address */ |
1099 | #define PKT_CodeSize (PKT_Data+6) /* Size of firmware in bytes */ | 1093 | #define PKT_CodeSize (PKT_Data+6) /* Size of firmware in bytes */ |
1100 | #define PKT_CmdString (PKT_Data+8) /* Command string */ | 1094 | #define PKT_CmdString (PKT_Data+8) /* Command string */ |
1101 | 1095 | ||
1102 | /***************************************************************************** | 1096 | /***************************************************************************** |
1103 | ************************ *********************** | 1097 | ************************ *********************** |
@@ -1111,10 +1105,10 @@ typedef struct _PKT | |||
1111 | RTA firmware has completed. | 1105 | RTA firmware has completed. |
1112 | */ | 1106 | */ |
1113 | #if 0 | 1107 | #if 0 |
1114 | #define PKT_Cmd (PKT_Data+0) /* Command code */ | 1108 | #define PKT_Cmd (PKT_Data+0) /* Command code */ |
1115 | #endif | 1109 | #endif |
1116 | #define PKT_LinkNumber (PKT_Data+1) /* Link number RTA booted on */ | 1110 | #define PKT_LinkNumber (PKT_Data+1) /* Link number RTA booted on */ |
1117 | #define PKT_SerialNumber (PKT_Data+2) /* 4 byte serial number */ | 1111 | #define PKT_SerialNumber (PKT_Data+2) /* 4 byte serial number */ |
1118 | 1112 | ||
1119 | /***************************************************************************** | 1113 | /***************************************************************************** |
1120 | ************************ *********************** | 1114 | ************************ *********************** |
@@ -1127,7 +1121,7 @@ typedef struct _PKT | |||
1127 | BOOT_RUP packet without the PKT_CMD_BIT set in the PKT->len field is sent | 1121 | BOOT_RUP packet without the PKT_CMD_BIT set in the PKT->len field is sent |
1128 | from RIO to the Driver as a request for a firmware boot packet. */ | 1122 | from RIO to the Driver as a request for a firmware boot packet. */ |
1129 | 1123 | ||
1130 | #define PKT_SequenceNumber (PKT_Data+0) /* Packet sequence number */ | 1124 | #define PKT_SequenceNumber (PKT_Data+0) /* Packet sequence number */ |
1131 | 1125 | ||
1132 | /***************************************************************************** | 1126 | /***************************************************************************** |
1133 | *********************** *********************** | 1127 | *********************** *********************** |
@@ -1141,9 +1135,9 @@ typedef struct _PKT | |||
1141 | packet with the 70 bytes of the requested sequence. | 1135 | packet with the 70 bytes of the requested sequence. |
1142 | */ | 1136 | */ |
1143 | #if 0 | 1137 | #if 0 |
1144 | #define PKT_SequenceNumber (PKT_Data+0) /* Packet sequence number */ | 1138 | #define PKT_SequenceNumber (PKT_Data+0) /* Packet sequence number */ |
1145 | #endif | 1139 | #endif |
1146 | #define PKT_FirmwarePacket (PKT_Data+2) /* Firmware packet */ | 1140 | #define PKT_FirmwarePacket (PKT_Data+2) /* Firmware packet */ |
1147 | 1141 | ||
1148 | /***************************************************************************** | 1142 | /***************************************************************************** |
1149 | **************************** **************************** | 1143 | **************************** **************************** |
@@ -1157,10 +1151,10 @@ typedef struct _PKT | |||
1157 | RTA to shut down and reboot. | 1151 | RTA to shut down and reboot. |
1158 | */ | 1152 | */ |
1159 | #if 0 | 1153 | #if 0 |
1160 | #define PKT_Cmd (PKT_Data+0) /* Command code */ | 1154 | #define PKT_Cmd (PKT_Data+0) /* Command code */ |
1161 | #endif | 1155 | #endif |
1162 | #define PKT_IfoadId1 (PKT_Data+2) /* IFOAD Id 1 */ | 1156 | #define PKT_IfoadId1 (PKT_Data+2) /* IFOAD Id 1 */ |
1163 | #define PKT_IfoadId2 (PKT_Data+3) /* IFOAD Id 2 */ | 1157 | #define PKT_IfoadId2 (PKT_Data+3) /* IFOAD Id 2 */ |
1164 | 1158 | ||
1165 | #define IFOADID1 0xAD | 1159 | #define IFOADID1 0xAD |
1166 | #define IFOADID2 0xF0 | 1160 | #define IFOADID2 0xF0 |
@@ -1177,9 +1171,9 @@ typedef struct _PKT | |||
1177 | RTA to flash its LEDs for a period of time. | 1171 | RTA to flash its LEDs for a period of time. |
1178 | */ | 1172 | */ |
1179 | #if 0 | 1173 | #if 0 |
1180 | #define PKT_Cmd (PKT_Data+0) /* Command code */ | 1174 | #define PKT_Cmd (PKT_Data+0) /* Command code */ |
1181 | #endif | 1175 | #endif |
1182 | #define PKT_IdentifyId (PKT_Data+2) /* defines pattern to flash */ | 1176 | #define PKT_IdentifyId (PKT_Data+2) /* defines pattern to flash */ |
1183 | 1177 | ||
1184 | /***************************************************************************** | 1178 | /***************************************************************************** |
1185 | **************************** *************************** | 1179 | **************************** *************************** |
@@ -1193,10 +1187,10 @@ typedef struct _PKT | |||
1193 | RTA to shut down and flash it's LEDs. | 1187 | RTA to shut down and flash it's LEDs. |
1194 | */ | 1188 | */ |
1195 | #if 0 | 1189 | #if 0 |
1196 | #define PKT_Cmd (PKT_Data+0) /* Command code */ | 1190 | #define PKT_Cmd (PKT_Data+0) /* Command code */ |
1197 | #endif | 1191 | #endif |
1198 | #define PKT_ZombieId1 (PKT_Data+2) /* ZOMBIE Id 1 */ | 1192 | #define PKT_ZombieId1 (PKT_Data+2) /* ZOMBIE Id 1 */ |
1199 | #define PKT_ZombieId2 (PKT_Data+3) /* ZOMBIE Id 2 */ | 1193 | #define PKT_ZombieId2 (PKT_Data+3) /* ZOMBIE Id 2 */ |
1200 | 1194 | ||
1201 | #define ZOMBIEID1 0x52 | 1195 | #define ZOMBIEID1 0x52 |
1202 | #define ZOMBIEID2 0x21 | 1196 | #define ZOMBIEID2 0x21 |
@@ -1213,11 +1207,11 @@ typedef struct _PKT | |||
1213 | to ask it's neighbouring RTA to shut down and reboot. | 1207 | to ask it's neighbouring RTA to shut down and reboot. |
1214 | */ | 1208 | */ |
1215 | #if 0 | 1209 | #if 0 |
1216 | #define PKT_Cmd (PKT_Data+0) /* Command code */ | 1210 | #define PKT_Cmd (PKT_Data+0) /* Command code */ |
1217 | #define PKT_LinkNumber (PKT_Data+1) /* Link number of RTA to UFOAD */ | 1211 | #define PKT_LinkNumber (PKT_Data+1) /* Link number of RTA to UFOAD */ |
1218 | #endif | 1212 | #endif |
1219 | #define PKT_UfoadId1 (PKT_Data+2) /* UFOAD Id 1 */ | 1213 | #define PKT_UfoadId1 (PKT_Data+2) /* UFOAD Id 1 */ |
1220 | #define PKT_UfoadId2 (PKT_Data+3) /* UFOAD Id 2 */ | 1214 | #define PKT_UfoadId2 (PKT_Data+3) /* UFOAD Id 2 */ |
1221 | 1215 | ||
1222 | #define UFOADID1 0x1E | 1216 | #define UFOADID1 0x1E |
1223 | #define UFOADID2 0x0D | 1217 | #define UFOADID2 0x0D |
@@ -1234,11 +1228,11 @@ typedef struct _PKT | |||
1234 | to pause booting on the specified link for 30 seconds. | 1228 | to pause booting on the specified link for 30 seconds. |
1235 | */ | 1229 | */ |
1236 | #if 0 | 1230 | #if 0 |
1237 | #define PKT_Cmd (PKT_Data+0) /* Command code */ | 1231 | #define PKT_Cmd (PKT_Data+0) /* Command code */ |
1238 | #define PKT_LinkNumber (PKT_Data+1) /* Link number of RTA to UFOAD */ | 1232 | #define PKT_LinkNumber (PKT_Data+1) /* Link number of RTA to UFOAD */ |
1239 | #endif | 1233 | #endif |
1240 | #define PKT_IwaitId1 (PKT_Data+2) /* IWAIT Id 1 */ | 1234 | #define PKT_IwaitId1 (PKT_Data+2) /* IWAIT Id 1 */ |
1241 | #define PKT_IwaitId2 (PKT_Data+3) /* IWAIT Id 2 */ | 1235 | #define PKT_IwaitId2 (PKT_Data+3) /* IWAIT Id 2 */ |
1242 | 1236 | ||
1243 | #define IWAITID1 0xDE | 1237 | #define IWAITID1 0xDE |
1244 | #define IWAITID2 0xB1 | 1238 | #define IWAITID2 0xB1 |
@@ -1255,20 +1249,20 @@ typedef struct _PKT | |||
1255 | RTA to a Driver to request an ID (RUP or unit number). | 1249 | RTA to a Driver to request an ID (RUP or unit number). |
1256 | */ | 1250 | */ |
1257 | #if 0 | 1251 | #if 0 |
1258 | #define PKT_Cmd (PKT_Data+0) /* Command code */ | 1252 | #define PKT_Cmd (PKT_Data+0) /* Command code */ |
1259 | #endif | 1253 | #endif |
1260 | #define PKT_SerialNumber (PKT_Data+2) /* 4 byte serial number */ | 1254 | #define PKT_SerialNumber (PKT_Data+2) /* 4 byte serial number */ |
1261 | #define PKT_ModuleTypes (PKT_Data+6) /* RTA Module types */ | 1255 | #define PKT_ModuleTypes (PKT_Data+6) /* RTA Module types */ |
1262 | 1256 | ||
1263 | /* ModuleTypes definitions... */ | 1257 | /* ModuleTypes definitions... */ |
1264 | #define MOD_BLANK 0x0F /* Blank plate attached */ | 1258 | #define MOD_BLANK 0x0F /* Blank plate attached */ |
1265 | #define MOD_RS232DB25 0x00 /* RS232 DB25 connector */ | 1259 | #define MOD_RS232DB25 0x00 /* RS232 DB25 connector */ |
1266 | #define MOD_RS232RJ45 0x01 /* RS232 RJ45 connector */ | 1260 | #define MOD_RS232RJ45 0x01 /* RS232 RJ45 connector */ |
1267 | #define MOD_RS422DB25 0x02 /* RS422 DB25 connector */ | 1261 | #define MOD_RS422DB25 0x02 /* RS422 DB25 connector */ |
1268 | #define MOD_RS485DB25 0x03 /* RS485 DB25 connector */ | 1262 | #define MOD_RS485DB25 0x03 /* RS485 DB25 connector */ |
1269 | #define MOD_PARALLEL 0x04 /* Centronics parallel */ | 1263 | #define MOD_PARALLEL 0x04 /* Centronics parallel */ |
1270 | 1264 | ||
1271 | #define MOD2 0x08 /* Set to indicate Rev2 module */ | 1265 | #define MOD2 0x08 /* Set to indicate Rev2 module */ |
1272 | 1266 | ||
1273 | /***************************************************************************** | 1267 | /***************************************************************************** |
1274 | ************************* ************************* | 1268 | ************************* ************************* |
@@ -1282,9 +1276,9 @@ typedef struct _PKT | |||
1282 | packet to cause the RTA to "Fall Over And Die"., i.e. shutdown and reboot. | 1276 | packet to cause the RTA to "Fall Over And Die"., i.e. shutdown and reboot. |
1283 | */ | 1277 | */ |
1284 | #if 0 | 1278 | #if 0 |
1285 | #define PKT_Cmd (PKT_Data+0) /* Command code */ | 1279 | #define PKT_Cmd (PKT_Data+0) /* Command code */ |
1286 | #endif | 1280 | #endif |
1287 | #define PKT_RouteCmdString (PKT_Data+2) /* Command string */ | 1281 | #define PKT_RouteCmdString (PKT_Data+2) /* Command string */ |
1288 | 1282 | ||
1289 | /***************************************************************************** | 1283 | /***************************************************************************** |
1290 | *********************** *********************** | 1284 | *********************** *********************** |
@@ -1298,13 +1292,13 @@ typedef struct _PKT | |||
1298 | packet to allocate the RTA's Id number (RUP number 1..16) | 1292 | packet to allocate the RTA's Id number (RUP number 1..16) |
1299 | */ | 1293 | */ |
1300 | #if 0 | 1294 | #if 0 |
1301 | #define PKT_Cmd (PKT_Data+0) /* Command code */ | 1295 | #define PKT_Cmd (PKT_Data+0) /* Command code */ |
1302 | #endif | 1296 | #endif |
1303 | #define PKT_IdNum (PKT_Data+1) /* RUP number for ports 1..8 */ | 1297 | #define PKT_IdNum (PKT_Data+1) /* RUP number for ports 1..8 */ |
1304 | #if 0 | 1298 | #if 0 |
1305 | #define PKT_RouteCmdString (PKT_Data+2) /* Command string */ | 1299 | #define PKT_RouteCmdString (PKT_Data+2) /* Command string */ |
1306 | #endif | 1300 | #endif |
1307 | #define PKT_IdNum2 (PKT_Data+0x17) /* RUP number for ports 9..16 */ | 1301 | #define PKT_IdNum2 (PKT_Data+0x17) /* RUP number for ports 9..16 */ |
1308 | 1302 | ||
1309 | /***************************************************************************** | 1303 | /***************************************************************************** |
1310 | *********************** *********************** | 1304 | *********************** *********************** |
@@ -1318,18 +1312,18 @@ typedef struct _PKT | |||
1318 | current link status. | 1312 | current link status. |
1319 | */ | 1313 | */ |
1320 | #if 0 | 1314 | #if 0 |
1321 | #define PKT_Cmd (PKT_Data+0) /* Command code */ | 1315 | #define PKT_Cmd (PKT_Data+0) /* Command code */ |
1322 | #endif | 1316 | #endif |
1323 | #define PKT_Link1Rup (PKT_Data+2) /* Link 1 RUP number */ | 1317 | #define PKT_Link1Rup (PKT_Data+2) /* Link 1 RUP number */ |
1324 | #define PKT_Link1Link (PKT_Data+3) /* Link 1 link number */ | 1318 | #define PKT_Link1Link (PKT_Data+3) /* Link 1 link number */ |
1325 | #define PKT_Link2Rup (PKT_Data+4) /* Link 2 RUP number */ | 1319 | #define PKT_Link2Rup (PKT_Data+4) /* Link 2 RUP number */ |
1326 | #define PKT_Link2Link (PKT_Data+5) /* Link 2 link number */ | 1320 | #define PKT_Link2Link (PKT_Data+5) /* Link 2 link number */ |
1327 | #define PKT_Link3Rup (PKT_Data+6) /* Link 3 RUP number */ | 1321 | #define PKT_Link3Rup (PKT_Data+6) /* Link 3 RUP number */ |
1328 | #define PKT_Link3Link (PKT_Data+7) /* Link 3 link number */ | 1322 | #define PKT_Link3Link (PKT_Data+7) /* Link 3 link number */ |
1329 | #define PKT_Link4Rup (PKT_Data+8) /* Link 4 RUP number */ | 1323 | #define PKT_Link4Rup (PKT_Data+8) /* Link 4 RUP number */ |
1330 | #define PKT_Link4Link (PKT_Data+9) /* Link 4 link number */ | 1324 | #define PKT_Link4Link (PKT_Data+9) /* Link 4 link number */ |
1331 | #define PKT_RtaVpdProm (PKT_Data+10) /* 32 bytes of RTA VPD PROM Contents */ | 1325 | #define PKT_RtaVpdProm (PKT_Data+10) /* 32 bytes of RTA VPD PROM Contents */ |
1332 | 1326 | ||
1333 | #endif /* _sxwinif_h */ | 1327 | #endif /* _sxwinif_h */ |
1334 | 1328 | ||
1335 | /* End of RIOWINIF.H */ | 1329 | /* End of RIOWINIF.H */ |
diff --git a/drivers/char/rio/riscos.h b/drivers/char/rio/riscos.h index 7685cc1d9e7b..60d66d0056ae 100644 --- a/drivers/char/rio/riscos.h +++ b/drivers/char/rio/riscos.h | |||
@@ -60,4 +60,4 @@ static char *_riscos_h_sccs_ = "@(#)riscos.h 1.2"; | |||
60 | #define RINDW(A) (*(ushort *)(A)) | 60 | #define RINDW(A) (*(ushort *)(A)) |
61 | #define WINDW(A,V) (*(ushort *)(A)=(ushort)(V)) | 61 | #define WINDW(A,V) (*(ushort *)(A)=(ushort)(V)) |
62 | 62 | ||
63 | #endif /* __rio_riscos_h__ */ | 63 | #endif /* __rio_riscos_h__ */ |
diff --git a/drivers/char/rio/rom.h b/drivers/char/rio/rom.h index ee79b8e5b972..58a7843625ff 100644 --- a/drivers/char/rio/rom.h +++ b/drivers/char/rio/rom.h | |||
@@ -39,19 +39,19 @@ | |||
39 | 39 | ||
40 | #ifndef lint | 40 | #ifndef lint |
41 | #ifdef SCCS | 41 | #ifdef SCCS |
42 | static char *_rio_rom_h_sccs = "@(#)rom.h 1.1" ; | 42 | static char *_rio_rom_h_sccs = "@(#)rom.h 1.1"; |
43 | #endif | 43 | #endif |
44 | #endif | 44 | #endif |
45 | 45 | ||
46 | typedef struct ROM ROM ; | 46 | typedef struct ROM ROM; |
47 | struct ROM { | 47 | struct ROM { |
48 | u_short slx ; | 48 | u_short slx; |
49 | char pcb_letter_rev ; | 49 | char pcb_letter_rev; |
50 | char pcb_number_rev ; | 50 | char pcb_number_rev; |
51 | char serial[4] ; | 51 | char serial[4]; |
52 | char year ; | 52 | char year; |
53 | char week ; | 53 | char week; |
54 | } ; | 54 | }; |
55 | 55 | ||
56 | #endif | 56 | #endif |
57 | 57 | ||
@@ -60,5 +60,3 @@ struct ROM { | |||
60 | #define ROM_LENGTH 0x20 | 60 | #define ROM_LENGTH 0x20 |
61 | 61 | ||
62 | /*********** end of file ***********/ | 62 | /*********** end of file ***********/ |
63 | |||
64 | |||
diff --git a/drivers/char/rio/route.h b/drivers/char/rio/route.h index c42dbb971718..769744e575ab 100644 --- a/drivers/char/rio/route.h +++ b/drivers/char/rio/route.h | |||
@@ -44,26 +44,26 @@ | |||
44 | #endif | 44 | #endif |
45 | 45 | ||
46 | #define MAX_LINKS 4 | 46 | #define MAX_LINKS 4 |
47 | #define MAX_NODES 17 /* Maximum nodes in a subnet */ | 47 | #define MAX_NODES 17 /* Maximum nodes in a subnet */ |
48 | #define NODE_BYTES ((MAX_NODES / 8) + 1) /* Number of bytes needed for | 48 | #define NODE_BYTES ((MAX_NODES / 8) + 1) /* Number of bytes needed for |
49 | 1 bit per node */ | 49 | 1 bit per node */ |
50 | #define ROUTE_DATA_SIZE (NODE_BYTES + 2) /* Number of bytes for complete | 50 | #define ROUTE_DATA_SIZE (NODE_BYTES + 2) /* Number of bytes for complete |
51 | info about cost etc. */ | 51 | info about cost etc. */ |
52 | #define ROUTES_PER_PACKET ((PKT_MAX_DATA_LEN -2)/ ROUTE_DATA_SIZE) | 52 | #define ROUTES_PER_PACKET ((PKT_MAX_DATA_LEN -2)/ ROUTE_DATA_SIZE) |
53 | /* Number of nodes we can squeeze | 53 | /* Number of nodes we can squeeze |
54 | into one packet */ | 54 | into one packet */ |
55 | #define MAX_TOPOLOGY_PACKETS (MAX_NODES / ROUTES_PER_PACKET + 1) | 55 | #define MAX_TOPOLOGY_PACKETS (MAX_NODES / ROUTES_PER_PACKET + 1) |
56 | /************************************************ | 56 | /************************************************ |
57 | * Define the types of command for the ROUTE RUP. | 57 | * Define the types of command for the ROUTE RUP. |
58 | ************************************************/ | 58 | ************************************************/ |
59 | #define ROUTE_REQUEST 0 /* Request an ID */ | 59 | #define ROUTE_REQUEST 0 /* Request an ID */ |
60 | #define ROUTE_FOAD 1 /* Kill the RTA */ | 60 | #define ROUTE_FOAD 1 /* Kill the RTA */ |
61 | #define ROUTE_ALREADY 2 /* ID given already */ | 61 | #define ROUTE_ALREADY 2 /* ID given already */ |
62 | #define ROUTE_USED 3 /* All ID's used */ | 62 | #define ROUTE_USED 3 /* All ID's used */ |
63 | #define ROUTE_ALLOCATE 4 /* Here it is */ | 63 | #define ROUTE_ALLOCATE 4 /* Here it is */ |
64 | #define ROUTE_REQ_TOP 5 /* I bet you didn't expect.... | 64 | #define ROUTE_REQ_TOP 5 /* I bet you didn't expect.... |
65 | the Topological Inquisition */ | 65 | the Topological Inquisition */ |
66 | #define ROUTE_TOPOLOGY 6 /* Topology request answered FD */ | 66 | #define ROUTE_TOPOLOGY 6 /* Topology request answered FD */ |
67 | /******************************************************************* | 67 | /******************************************************************* |
68 | * Define the Route Map Structure | 68 | * Define the Route Map Structure |
69 | * | 69 | * |
@@ -72,22 +72,22 @@ | |||
72 | ******************************************************************/ | 72 | ******************************************************************/ |
73 | typedef struct COST_ROUTE COST_ROUTE; | 73 | typedef struct COST_ROUTE COST_ROUTE; |
74 | struct COST_ROUTE { | 74 | struct COST_ROUTE { |
75 | unsigned char cost; /* Cost down this link */ | 75 | unsigned char cost; /* Cost down this link */ |
76 | unsigned char route[NODE_BYTES]; /* Nodes thorough this route */ | 76 | unsigned char route[NODE_BYTES]; /* Nodes thorough this route */ |
77 | } ; | 77 | }; |
78 | 78 | ||
79 | typedef struct ROUTE_STR ROUTE_STR ; | 79 | typedef struct ROUTE_STR ROUTE_STR; |
80 | struct ROUTE_STR { | 80 | struct ROUTE_STR { |
81 | COST_ROUTE cost_route[MAX_LINKS]; | 81 | COST_ROUTE cost_route[MAX_LINKS]; |
82 | /* cost / route for this link */ | 82 | /* cost / route for this link */ |
83 | ushort favoured; /* favoured link */ | 83 | ushort favoured; /* favoured link */ |
84 | } ; | 84 | }; |
85 | 85 | ||
86 | 86 | ||
87 | #define NO_LINK (short) 5 /* Link unattached */ | 87 | #define NO_LINK (short) 5 /* Link unattached */ |
88 | #define ROUTE_NO_ID (short) 100 /* No Id */ | 88 | #define ROUTE_NO_ID (short) 100 /* No Id */ |
89 | #define ROUTE_DISCONNECT (ushort) 0xff /* Not connected */ | 89 | #define ROUTE_DISCONNECT (ushort) 0xff /* Not connected */ |
90 | #define ROUTE_INTERCONNECT (ushort) 0x40 /* Sub-net interconnect */ | 90 | #define ROUTE_INTERCONNECT (ushort) 0x40 /* Sub-net interconnect */ |
91 | 91 | ||
92 | 92 | ||
93 | #define SYNC_RUP (ushort) 255 | 93 | #define SYNC_RUP (ushort) 255 |
@@ -99,10 +99,9 @@ struct ROUTE_STR { | |||
99 | #define STATUS_RUP (ushort) 249 | 99 | #define STATUS_RUP (ushort) 249 |
100 | #define POWER_RUP (ushort) 248 | 100 | #define POWER_RUP (ushort) 248 |
101 | 101 | ||
102 | #define HIGHEST_RUP (ushort) 255 /* Set to Top one */ | 102 | #define HIGHEST_RUP (ushort) 255 /* Set to Top one */ |
103 | #define LOWEST_RUP (ushort) 248 /* Set to bottom one */ | 103 | #define LOWEST_RUP (ushort) 248 /* Set to bottom one */ |
104 | 104 | ||
105 | #endif | 105 | #endif |
106 | 106 | ||
107 | /*********** end of file ***********/ | 107 | /*********** end of file ***********/ |
108 | |||
diff --git a/drivers/char/rio/rtahw.h b/drivers/char/rio/rtahw.h index 06860118cbc5..e6c2cdfd3a1f 100644 --- a/drivers/char/rio/rtahw.h +++ b/drivers/char/rio/rtahw.h | |||
@@ -37,7 +37,7 @@ | |||
37 | 37 | ||
38 | #ifndef lint | 38 | #ifndef lint |
39 | #ifdef SCCS_LABELS | 39 | #ifdef SCCS_LABELS |
40 | static char *_rio_rtahw_h_sccs = "@(#)rtahw.h 1.5" ; | 40 | static char *_rio_rtahw_h_sccs = "@(#)rtahw.h 1.5"; |
41 | #endif | 41 | #endif |
42 | #endif | 42 | #endif |
43 | 43 | ||
@@ -58,12 +58,12 @@ static char *_rio_rtahw_h_sccs = "@(#)rtahw.h 1.5" ; | |||
58 | ** Define the different types of modules we can have | 58 | ** Define the different types of modules we can have |
59 | */ | 59 | */ |
60 | enum module { | 60 | enum module { |
61 | MOD_BLANK = 0x0f, /* Blank plate attached */ | 61 | MOD_BLANK = 0x0f, /* Blank plate attached */ |
62 | MOD_RS232DB25 = 0x00, /* RS232 DB25 connector */ | 62 | MOD_RS232DB25 = 0x00, /* RS232 DB25 connector */ |
63 | MOD_RS232RJ45 = 0x01, /* RS232 RJ45 connector */ | 63 | MOD_RS232RJ45 = 0x01, /* RS232 RJ45 connector */ |
64 | MOD_RS422DB25 = 0x02, /* RS422 DB25 connector */ | 64 | MOD_RS422DB25 = 0x02, /* RS422 DB25 connector */ |
65 | MOD_RS485DB25 = 0x03, /* RS485 DB25 connector */ | 65 | MOD_RS485DB25 = 0x03, /* RS485 DB25 connector */ |
66 | MOD_PARALLEL = 0x04 /* Centronics parallel */ | 66 | MOD_PARALLEL = 0x04 /* Centronics parallel */ |
67 | }; | 67 | }; |
68 | 68 | ||
69 | #define TYPE_HOST 0 | 69 | #define TYPE_HOST 0 |
diff --git a/drivers/char/rio/rup.h b/drivers/char/rio/rup.h index b9d2bc03d14b..8d44fec91dd5 100644 --- a/drivers/char/rio/rup.h +++ b/drivers/char/rio/rup.h | |||
@@ -44,39 +44,38 @@ | |||
44 | #endif | 44 | #endif |
45 | 45 | ||
46 | #if defined( HOST ) || defined( INKERNEL ) | 46 | #if defined( HOST ) || defined( INKERNEL ) |
47 | #define MAX_RUP ((short) 16) | 47 | #define MAX_RUP ((short) 16) |
48 | #endif | 48 | #endif |
49 | #ifdef RTA | 49 | #ifdef RTA |
50 | #define MAX_RUP ((short) 1) | 50 | #define MAX_RUP ((short) 1) |
51 | #endif | 51 | #endif |
52 | 52 | ||
53 | #define PKTS_PER_RUP ((short) 2) /* They are always used in pairs */ | 53 | #define PKTS_PER_RUP ((short) 2) /* They are always used in pairs */ |
54 | 54 | ||
55 | /************************************************* | 55 | /************************************************* |
56 | * Define all the packet request stuff | 56 | * Define all the packet request stuff |
57 | ************************************************/ | 57 | ************************************************/ |
58 | #define TX_RUP_INACTIVE 0 /* Nothing to transmit */ | 58 | #define TX_RUP_INACTIVE 0 /* Nothing to transmit */ |
59 | #define TX_PACKET_READY 1 /* Transmit packet ready */ | 59 | #define TX_PACKET_READY 1 /* Transmit packet ready */ |
60 | #define TX_LOCK_RUP 2 /* Transmit side locked */ | 60 | #define TX_LOCK_RUP 2 /* Transmit side locked */ |
61 | 61 | ||
62 | #define RX_RUP_INACTIVE 0 /* Nothing received */ | 62 | #define RX_RUP_INACTIVE 0 /* Nothing received */ |
63 | #define RX_PACKET_READY 1 /* Packet received */ | 63 | #define RX_PACKET_READY 1 /* Packet received */ |
64 | 64 | ||
65 | #define RUP_NO_OWNER 0xff /* RUP not owned by any process */ | 65 | #define RUP_NO_OWNER 0xff /* RUP not owned by any process */ |
66 | 66 | ||
67 | struct RUP { | 67 | struct RUP { |
68 | PKT_ptr txpkt; /* Outgoing packet */ | 68 | PKT_ptr txpkt; /* Outgoing packet */ |
69 | PKT_ptr rxpkt; /* Incoming packet */ | 69 | PKT_ptr rxpkt; /* Incoming packet */ |
70 | WORD link; /* Which link to send down? */ | 70 | WORD link; /* Which link to send down? */ |
71 | BYTE rup_dest_unit[2]; /* Destination unit */ | 71 | BYTE rup_dest_unit[2]; /* Destination unit */ |
72 | WORD handshake; /* For handshaking */ | 72 | WORD handshake; /* For handshaking */ |
73 | WORD timeout; /* Timeout */ | 73 | WORD timeout; /* Timeout */ |
74 | WORD status; /* Status */ | 74 | WORD status; /* Status */ |
75 | WORD txcontrol; /* Transmit control */ | 75 | WORD txcontrol; /* Transmit control */ |
76 | WORD rxcontrol; /* Receive control */ | 76 | WORD rxcontrol; /* Receive control */ |
77 | }; | 77 | }; |
78 | 78 | ||
79 | #endif | 79 | #endif |
80 | 80 | ||
81 | /*********** end of file ***********/ | 81 | /*********** end of file ***********/ |
82 | |||
diff --git a/drivers/char/rio/rupstat.h b/drivers/char/rio/rupstat.h index b4aafaff0d78..56d828c63d28 100644 --- a/drivers/char/rio/rupstat.h +++ b/drivers/char/rio/rupstat.h | |||
@@ -39,7 +39,7 @@ | |||
39 | 39 | ||
40 | #ifndef lint | 40 | #ifndef lint |
41 | #ifdef SCCS_LABELS | 41 | #ifdef SCCS_LABELS |
42 | static char *_rio_rupstat_h_sccs = "@(#)rupstat.h 1.1" ; | 42 | static char *_rio_rupstat_h_sccs = "@(#)rupstat.h 1.1"; |
43 | #endif | 43 | #endif |
44 | #endif | 44 | #endif |
45 | 45 | ||
@@ -48,4 +48,3 @@ static char *_rio_rupstat_h_sccs = "@(#)rupstat.h 1.1" ; | |||
48 | #define STATUS_TOPOLOGY 2 | 48 | #define STATUS_TOPOLOGY 2 |
49 | 49 | ||
50 | #endif | 50 | #endif |
51 | |||
diff --git a/drivers/char/rio/sam.h b/drivers/char/rio/sam.h index c1accb8cb624..31494054b213 100644 --- a/drivers/char/rio/sam.h +++ b/drivers/char/rio/sam.h | |||
@@ -60,15 +60,12 @@ | |||
60 | #define RX FALSE | 60 | #define RX FALSE |
61 | 61 | ||
62 | 62 | ||
63 | typedef struct FREE_LIST FREE_LIST ; | 63 | typedef struct FREE_LIST FREE_LIST; |
64 | struct FREE_LIST { | 64 | struct FREE_LIST { |
65 | FREE_LIST_ptr next ; | 65 | FREE_LIST_ptr next; |
66 | FREE_LIST_ptr prev ; | 66 | FREE_LIST_ptr prev; |
67 | } ; | 67 | }; |
68 | 68 | ||
69 | 69 | ||
70 | #endif | 70 | #endif |
71 | /*********** end of file ***********/ | 71 | /*********** end of file ***********/ |
72 | |||
73 | |||
74 | |||
diff --git a/drivers/char/rio/selftest.h b/drivers/char/rio/selftest.h index deae48722a21..7a3dba352323 100644 --- a/drivers/char/rio/selftest.h +++ b/drivers/char/rio/selftest.h | |||
@@ -38,36 +38,36 @@ | |||
38 | ** selftest on a booting RTA. | 38 | ** selftest on a booting RTA. |
39 | */ | 39 | */ |
40 | typedef struct { | 40 | typedef struct { |
41 | short magic; /* Identifies packet type */ | 41 | short magic; /* Identifies packet type */ |
42 | int test; /* Test number, see below */ | 42 | int test; /* Test number, see below */ |
43 | unsigned int result; /* Result value */ | 43 | unsigned int result; /* Result value */ |
44 | unsigned int dataIn; | 44 | unsigned int dataIn; |
45 | unsigned int dataOut; | 45 | unsigned int dataOut; |
46 | }selftestStruct; | 46 | } selftestStruct; |
47 | 47 | ||
48 | /* | 48 | /* |
49 | ** The different tests are identified by the following data values. | 49 | ** The different tests are identified by the following data values. |
50 | */ | 50 | */ |
51 | enum test { | 51 | enum test { |
52 | TESTS_COMPLETE = 0x00, | 52 | TESTS_COMPLETE = 0x00, |
53 | MEMTEST_ADDR = 0x01, | 53 | MEMTEST_ADDR = 0x01, |
54 | MEMTEST_BIT = 0x02, | 54 | MEMTEST_BIT = 0x02, |
55 | MEMTEST_FILL = 0x03, | 55 | MEMTEST_FILL = 0x03, |
56 | MEMTEST_DATABUS = 0x04, | 56 | MEMTEST_DATABUS = 0x04, |
57 | MEMTEST_ADDRBUS = 0x05, | 57 | MEMTEST_ADDRBUS = 0x05, |
58 | CD1400_INIT = 0x10, | 58 | CD1400_INIT = 0x10, |
59 | CD1400_LOOP = 0x11, | 59 | CD1400_LOOP = 0x11, |
60 | CD1400_INTERRUPT = 0x12 | 60 | CD1400_INTERRUPT = 0x12 |
61 | }; | 61 | }; |
62 | 62 | ||
63 | enum result { | 63 | enum result { |
64 | E_PORT = 0x10, | 64 | E_PORT = 0x10, |
65 | E_TX = 0x11, | 65 | E_TX = 0x11, |
66 | E_RX = 0x12, | 66 | E_RX = 0x12, |
67 | E_EXCEPT = 0x13, | 67 | E_EXCEPT = 0x13, |
68 | E_COMPARE = 0x14, | 68 | E_COMPARE = 0x14, |
69 | E_MODEM = 0x15, | 69 | E_MODEM = 0x15, |
70 | E_TIMEOUT = 0x16, | 70 | E_TIMEOUT = 0x16, |
71 | E_INTERRUPT = 0x17 | 71 | E_INTERRUPT = 0x17 |
72 | }; | 72 | }; |
73 | #endif /* _selftests_h_ */ | 73 | #endif /* _selftests_h_ */ |
diff --git a/drivers/char/rio/space.h b/drivers/char/rio/space.h index 72398d342051..1f12690f9d1f 100644 --- a/drivers/char/rio/space.h +++ b/drivers/char/rio/space.h | |||
@@ -42,4 +42,4 @@ extern int rio_bases[]; | |||
42 | extern int rio_limits[]; | 42 | extern int rio_limits[]; |
43 | extern int rio_vects[]; | 43 | extern int rio_vects[]; |
44 | 44 | ||
45 | #endif /* __rio_space_h__ */ | 45 | #endif /* __rio_space_h__ */ |
diff --git a/drivers/char/rio/sysmap.h b/drivers/char/rio/sysmap.h index fdc731393576..e1c6f1160dff 100644 --- a/drivers/char/rio/sysmap.h +++ b/drivers/char/rio/sysmap.h | |||
@@ -37,27 +37,26 @@ | |||
37 | 37 | ||
38 | #ifndef lint | 38 | #ifndef lint |
39 | #ifdef SCCS_LABELS | 39 | #ifdef SCCS_LABELS |
40 | static char *_rio_sysmap_h_sccs = "@(#)sysmap.h 1.1" ; | 40 | static char *_rio_sysmap_h_sccs = "@(#)sysmap.h 1.1"; |
41 | #endif | 41 | #endif |
42 | #endif | 42 | #endif |
43 | 43 | ||
44 | #define SYSTEM_MAP_LEN 64 /* Len of System Map array */ | 44 | #define SYSTEM_MAP_LEN 64 /* Len of System Map array */ |
45 | 45 | ||
46 | 46 | ||
47 | typedef struct SYS_MAP SYS_MAP ; | 47 | typedef struct SYS_MAP SYS_MAP; |
48 | typedef struct SYS_MAP_LINK SYS_MAP_LINK ; | 48 | typedef struct SYS_MAP_LINK SYS_MAP_LINK; |
49 | 49 | ||
50 | struct SYS_MAP_LINK { | 50 | struct SYS_MAP_LINK { |
51 | short id ; /* Unit Id */ | 51 | short id; /* Unit Id */ |
52 | short link ; /* Id's Link */ | 52 | short link; /* Id's Link */ |
53 | short been_here ; /* Used by map_gen */ | 53 | short been_here; /* Used by map_gen */ |
54 | } ; | 54 | }; |
55 | 55 | ||
56 | struct SYS_MAP { | 56 | struct SYS_MAP { |
57 | char serial_num[4] ; | 57 | char serial_num[4]; |
58 | SYS_MAP_LINK link[4] ; | 58 | SYS_MAP_LINK link[4]; |
59 | } ; | 59 | }; |
60 | 60 | ||
61 | 61 | ||
62 | /*********** end of file ***********/ | 62 | /*********** end of file ***********/ |
63 | |||
diff --git a/drivers/char/rio/timeouts.h b/drivers/char/rio/timeouts.h index 11b31330c901..a8b5be3ca9bf 100644 --- a/drivers/char/rio/timeouts.h +++ b/drivers/char/rio/timeouts.h | |||
@@ -37,15 +37,14 @@ | |||
37 | 37 | ||
38 | #ifndef lint | 38 | #ifndef lint |
39 | #ifdef SCCS_LABELS | 39 | #ifdef SCCS_LABELS |
40 | static char *_rio_defaults_h_sccs = "@(#)timeouts.h 1.3" ; | 40 | static char *_rio_defaults_h_sccs = "@(#)timeouts.h 1.3"; |
41 | #endif | 41 | #endif |
42 | #endif | 42 | #endif |
43 | 43 | ||
44 | #define MILLISECOND (int) (1000/64) /* 15.625 low ticks */ | 44 | #define MILLISECOND (int) (1000/64) /* 15.625 low ticks */ |
45 | #define SECOND (int) 15625 /* Low priority ticks */ | 45 | #define SECOND (int) 15625 /* Low priority ticks */ |
46 | 46 | ||
47 | #define TX_TIMEOUT (int) (200 * MILLISECOND) | 47 | #define TX_TIMEOUT (int) (200 * MILLISECOND) |
48 | 48 | ||
49 | 49 | ||
50 | /*********** end of file ***********/ | 50 | /*********** end of file ***********/ |
51 | |||
diff --git a/drivers/char/rio/top.h b/drivers/char/rio/top.h index 255c40d463a6..d15a11dc4f73 100644 --- a/drivers/char/rio/top.h +++ b/drivers/char/rio/top.h | |||
@@ -40,10 +40,9 @@ static char *_top_h_sccs_ = "@(#)top.h 1.2"; | |||
40 | /* | 40 | /* |
41 | ** Topology information | 41 | ** Topology information |
42 | */ | 42 | */ |
43 | struct Top | 43 | struct Top { |
44 | { | 44 | uchar Unit; |
45 | uchar Unit; | 45 | uchar Link; |
46 | uchar Link; | ||
47 | }; | 46 | }; |
48 | 47 | ||
49 | #endif /* __rio_top_h__ */ | 48 | #endif /* __rio_top_h__ */ |
diff --git a/drivers/char/rio/typdef.h b/drivers/char/rio/typdef.h index 2cb9dd693fa1..185b889e1510 100644 --- a/drivers/char/rio/typdef.h +++ b/drivers/char/rio/typdef.h | |||
@@ -45,11 +45,11 @@ static char *_typdef_h_sccs_ = "@(#)typdef.h 1.2"; | |||
45 | ** These types are ONLY to be used for refering to data structures | 45 | ** These types are ONLY to be used for refering to data structures |
46 | ** on the RIO Host card! | 46 | ** on the RIO Host card! |
47 | */ | 47 | */ |
48 | typedef volatile unsigned char BYTE; | 48 | typedef volatile unsigned char BYTE; |
49 | typedef volatile unsigned short WORD; | 49 | typedef volatile unsigned short WORD; |
50 | typedef volatile unsigned int DWORD; | 50 | typedef volatile unsigned int DWORD; |
51 | typedef volatile unsigned short RIOP; | 51 | typedef volatile unsigned short RIOP; |
52 | typedef volatile short NUMBER; | 52 | typedef volatile short NUMBER; |
53 | 53 | ||
54 | 54 | ||
55 | /* | 55 | /* |
@@ -59,13 +59,13 @@ typedef volatile short NUMBER; | |||
59 | ** are here only to make the source compile. | 59 | ** are here only to make the source compile. |
60 | */ | 60 | */ |
61 | /* typedef unsigned int uint; */ | 61 | /* typedef unsigned int uint; */ |
62 | typedef unsigned long ulong_t; | 62 | typedef unsigned long ulong_t; |
63 | typedef unsigned short ushort_t; | 63 | typedef unsigned short ushort_t; |
64 | typedef unsigned char uchar_t; | 64 | typedef unsigned char uchar_t; |
65 | typedef unsigned char queue_t; | 65 | typedef unsigned char queue_t; |
66 | typedef unsigned char mblk_t; | 66 | typedef unsigned char mblk_t; |
67 | typedef unsigned int paddr_t; | 67 | typedef unsigned int paddr_t; |
68 | typedef unsigned char uchar; | 68 | typedef unsigned char uchar; |
69 | 69 | ||
70 | #define TPNULL ((ushort)(0x8000)) | 70 | #define TPNULL ((ushort)(0x8000)) |
71 | 71 | ||
@@ -73,10 +73,10 @@ typedef unsigned char uchar; | |||
73 | /* | 73 | /* |
74 | ** RIO structures defined in other include files. | 74 | ** RIO structures defined in other include files. |
75 | */ | 75 | */ |
76 | typedef struct PKT PKT; | 76 | typedef struct PKT PKT; |
77 | typedef struct LPB LPB; | 77 | typedef struct LPB LPB; |
78 | typedef struct RUP RUP; | 78 | typedef struct RUP RUP; |
79 | typedef struct Port Port; | 79 | typedef struct Port Port; |
80 | typedef struct DpRam DpRam; | 80 | typedef struct DpRam DpRam; |
81 | 81 | ||
82 | #endif /* __rio_typdef_h__ */ | 82 | #endif /* __rio_typdef_h__ */ |
diff --git a/drivers/char/rio/unixrup.h b/drivers/char/rio/unixrup.h index eddf86278abc..a126c7cabac6 100644 --- a/drivers/char/rio/unixrup.h +++ b/drivers/char/rio/unixrup.h | |||
@@ -41,16 +41,15 @@ static char *_unixrup_h_sccs_ = "@(#)unixrup.h 1.2"; | |||
41 | ** UnixRup data structure. This contains pointers to actual RUPs on the | 41 | ** UnixRup data structure. This contains pointers to actual RUPs on the |
42 | ** host card, and all the command/boot control stuff. | 42 | ** host card, and all the command/boot control stuff. |
43 | */ | 43 | */ |
44 | struct UnixRup | 44 | struct UnixRup { |
45 | { | 45 | struct CmdBlk *CmdsWaitingP; /* Commands waiting to be done */ |
46 | struct CmdBlk *CmdsWaitingP; /* Commands waiting to be done */ | 46 | struct CmdBlk *CmdPendingP; /* The command currently being sent */ |
47 | struct CmdBlk *CmdPendingP; /* The command currently being sent */ | 47 | struct RUP *RupP; /* the Rup to send it to */ |
48 | struct RUP *RupP; /* the Rup to send it to */ | 48 | uint Id; /* Id number */ |
49 | uint Id; /* Id number */ | 49 | uint BaseSysPort; /* SysPort of first tty on this RTA */ |
50 | uint BaseSysPort; /* SysPort of first tty on this RTA */ | 50 | uint ModTypes; /* Modules on this RTA */ |
51 | uint ModTypes; /* Modules on this RTA */ | 51 | spinlock_t RupLock; /* Lock structure for MPX */ |
52 | spinlock_t RupLock; /* Lock structure for MPX */ | 52 | /* struct lockb RupLock; *//* Lock structure for MPX */ |
53 | /* struct lockb RupLock; */ /* Lock structure for MPX */ | ||
54 | }; | 53 | }; |
55 | 54 | ||
56 | #endif /* __rio_unixrup_h__ */ | 55 | #endif /* __rio_unixrup_h__ */ |