diff options
author | Andrew Morton <akpm@osdl.org> | 2006-01-11 15:17:49 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-01-11 21:42:14 -0500 |
commit | 8d8706e2f86d28814c1b40a116ffdeca35e4c949 (patch) | |
tree | 146567d7a807feb37a5368fbb4a6ee76d9d7bc7e /drivers/char/rio/rioparam.c | |
parent | a9415644583ef344e02f84faf5fe24bfadb2af8e (diff) |
[PATCH] lindent rio drivers
Run all rio files through indent -kr -i8 -bri0 -l255, as requested by Alan.
rioboot.c and rioinit.c were skipped due to worrisome lindent warnings.
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/char/rio/rioparam.c')
-rw-r--r-- | drivers/char/rio/rioparam.c | 563 |
1 files changed, 278 insertions, 285 deletions
diff --git a/drivers/char/rio/rioparam.c b/drivers/char/rio/rioparam.c index f10916326ec..4cc7f4942bf 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 | } |