aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/rio/riotty.c
diff options
context:
space:
mode:
authorAlan Cox <alan@lxorguk.ukuu.org.uk>2006-03-24 06:18:32 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2006-03-24 10:33:29 -0500
commit554b7c801e379e8c0072533b4da89a3a003cbfac (patch)
tree86f2da1549e37648948fe3d091ecc76c18714597 /drivers/char/rio/riotty.c
parent57c2d60e1e3db506cdcecbf60f939593125db7f8 (diff)
[PATCH] Yet more rio cleaning (2 of 2)
- Remove more unused headers - Remove various typedefs - Correct type of PaddrP (physical addresses should be ulong) - Kill use of bcopy - More printk cleanups - Kill true/false - Clean up direct access to pci BARs Signed-off-by: Alan Cox <alan@redhat.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/char/rio/riotty.c')
-rw-r--r--drivers/char/rio/riotty.c179
1 files changed, 49 insertions, 130 deletions
diff --git a/drivers/char/rio/riotty.c b/drivers/char/rio/riotty.c
index 0ca431b4c474..204267613c9c 100644
--- a/drivers/char/rio/riotty.c
+++ b/drivers/char/rio/riotty.c
@@ -56,15 +56,12 @@ static char *_riotty_c_sccs_ = "@(#)riotty.c 1.3";
56 56
57#include "linux_compat.h" 57#include "linux_compat.h"
58#include "rio_linux.h" 58#include "rio_linux.h"
59#include "typdef.h"
60#include "pkt.h" 59#include "pkt.h"
61#include "daemon.h" 60#include "daemon.h"
62#include "rio.h" 61#include "rio.h"
63#include "riospace.h" 62#include "riospace.h"
64#include "top.h"
65#include "cmdpkt.h" 63#include "cmdpkt.h"
66#include "map.h" 64#include "map.h"
67#include "riotypes.h"
68#include "rup.h" 65#include "rup.h"
69#include "port.h" 66#include "port.h"
70#include "riodrvr.h" 67#include "riodrvr.h"
@@ -77,58 +74,18 @@ static char *_riotty_c_sccs_ = "@(#)riotty.c 1.3";
77#include "unixrup.h" 74#include "unixrup.h"
78#include "board.h" 75#include "board.h"
79#include "host.h" 76#include "host.h"
80#include "error.h"
81#include "phb.h" 77#include "phb.h"
82#include "link.h" 78#include "link.h"
83#include "cmdblk.h" 79#include "cmdblk.h"
84#include "route.h" 80#include "route.h"
85#include "control.h"
86#include "cirrus.h" 81#include "cirrus.h"
87#include "rioioctl.h" 82#include "rioioctl.h"
88#include "param.h" 83#include "param.h"
89#include "list.h"
90#include "sam.h"
91 84
92static void RIOClearUp(struct Port *PortP); 85static void RIOClearUp(struct Port *PortP);
93int RIOShortCommand(struct rio_info *p, struct Port *PortP, int command, int len, int arg);
94
95
96extern int conv_vb[]; /* now defined in ttymgr.c */
97extern int conv_bv[]; /* now defined in ttymgr.c */
98
99/*
100** 16.09.1998 ARG - Fix to build riotty.k.o for Modular Kernel Support
101**
102** ep.def.h is necessary for Modular Kernel Support
103** DO NOT place any kernel 'extern's after this line
104** or this source file will not build riotty.k.o
105*/
106#ifdef uLYNX
107#include <ep.def.h>
108#endif
109 86
110#ifdef NEED_THIS2 87/* Below belongs in func.h */
111static struct old_sgttyb default_sg = { 88int RIOShortCommand(struct rio_info *p, struct Port *PortP, int command, int len, int arg);
112 B19200, B19200, /* input and output speed */
113 'H' - '@', /* erase char */
114 -1, /* 2nd erase char */
115 'U' - '@', /* kill char */
116 ECHO | CRMOD, /* mode */
117 'C' - '@', /* interrupt character */
118 '\\' - '@', /* quit char */
119 'Q' - '@', /* start char */
120 'S' - '@', /* stop char */
121 'D' - '@', /* EOF */
122 -1, /* brk */
123 (LCRTBS | LCRTERA | LCRTKIL | LCTLECH), /* local mode word */
124 'Z' - '@', /* process stop */
125 'Y' - '@', /* delayed stop */
126 'R' - '@', /* reprint line */
127 'O' - '@', /* flush output */
128 'W' - '@', /* word erase */
129 'V' - '@' /* literal next char */
130};
131#endif
132 89
133 90
134extern struct rio_info *p; 91extern struct rio_info *p;
@@ -137,7 +94,6 @@ extern struct rio_info *p;
137int riotopen(struct tty_struct *tty, struct file *filp) 94int riotopen(struct tty_struct *tty, struct file *filp)
138{ 95{
139 unsigned int SysPort; 96 unsigned int SysPort;
140 int Modem;
141 int repeat_this = 250; 97 int repeat_this = 250;
142 struct Port *PortP; /* pointer to the port structure */ 98 struct Port *PortP; /* pointer to the port structure */
143 unsigned long flags; 99 unsigned long flags;
@@ -151,7 +107,6 @@ int riotopen(struct tty_struct *tty, struct file *filp)
151 tty->driver_data = NULL; 107 tty->driver_data = NULL;
152 108
153 SysPort = rio_minor(tty); 109 SysPort = rio_minor(tty);
154 Modem = rio_ismodem(tty);
155 110
156 if (p->RIOFailed) { 111 if (p->RIOFailed) {
157 rio_dprintk(RIO_DEBUG_TTY, "System initialisation failed\n"); 112 rio_dprintk(RIO_DEBUG_TTY, "System initialisation failed\n");
@@ -159,7 +114,7 @@ int riotopen(struct tty_struct *tty, struct file *filp)
159 return -ENXIO; 114 return -ENXIO;
160 } 115 }
161 116
162 rio_dprintk(RIO_DEBUG_TTY, "port open SysPort %d (%s) (mapped:%d)\n", SysPort, Modem ? "Modem" : "tty", p->RIOPortp[SysPort]->Mapped); 117 rio_dprintk(RIO_DEBUG_TTY, "port open SysPort %d (mapped:%d)\n", SysPort, p->RIOPortp[SysPort]->Mapped);
163 118
164 /* 119 /*
165 ** Validate that we have received a legitimate request. 120 ** Validate that we have received a legitimate request.
@@ -305,15 +260,12 @@ int riotopen(struct tty_struct *tty, struct file *filp)
305 /* PortP->gs.xmit_cnt = 0; */ 260 /* PortP->gs.xmit_cnt = 0; */
306 261
307 rio_spin_unlock_irqrestore(&PortP->portSem, flags); 262 rio_spin_unlock_irqrestore(&PortP->portSem, flags);
308#ifdef NEED_THIS
309 ttyseth(PortP, tp, (struct old_sgttyb *) &default_sg);
310#endif
311 263
312 /* Someone explain to me why this delay/config is 264 /* Someone explain to me why this delay/config is
313 here. If I read the docs correctly the "open" 265 here. If I read the docs correctly the "open"
314 command piggybacks the parameters immediately. 266 command piggybacks the parameters immediately.
315 -- REW */ 267 -- REW */
316 RIOParam(PortP, OPEN, Modem, OK_TO_SLEEP); /* Open the port */ 268 RIOParam(PortP, OPEN, 1, OK_TO_SLEEP); /* Open the port */
317 rio_spin_lock_irqsave(&PortP->portSem, flags); 269 rio_spin_lock_irqsave(&PortP->portSem, flags);
318 270
319 /* 271 /*
@@ -321,20 +273,6 @@ int riotopen(struct tty_struct *tty, struct file *filp)
321 */ 273 */
322 while (!(PortP->PortState & PORT_ISOPEN) && !p->RIOHalted) { 274 while (!(PortP->PortState & PORT_ISOPEN) && !p->RIOHalted) {
323 rio_dprintk(RIO_DEBUG_TTY, "Waiting for PORT_ISOPEN-currently %x\n", PortP->PortState); 275 rio_dprintk(RIO_DEBUG_TTY, "Waiting for PORT_ISOPEN-currently %x\n", PortP->PortState);
324/*
325** 15.10.1998 ARG - ESIL 0759
326** (Part) fix for port being trashed when opened whilst RTA "disconnected"
327** Take out the limited wait - now wait for ever or until user
328** bangs us out.
329**
330 if (repeat_this -- <= 0) {
331 rio_dprint(RIO_DEBUG_TTY, ("Waiting for open to finish timed out.\n"));
332 RIOPreemptiveCmd(p, PortP, FCLOSE );
333 rio_spin_unlock_irqrestore(&PortP->portSem, flags);
334 return -EINTR;
335 }
336**
337*/
338 rio_spin_unlock_irqrestore(&PortP->portSem, flags); 276 rio_spin_unlock_irqrestore(&PortP->portSem, flags);
339 if (RIODelay(PortP, HUNDRED_MS) == RIO_FAIL) { 277 if (RIODelay(PortP, HUNDRED_MS) == RIO_FAIL) {
340 rio_dprintk(RIO_DEBUG_TTY, "Waiting for open to finish broken by signal\n"); 278 rio_dprintk(RIO_DEBUG_TTY, "Waiting for open to finish broken by signal\n");
@@ -354,74 +292,58 @@ int riotopen(struct tty_struct *tty, struct file *filp)
354 } 292 }
355 rio_dprintk(RIO_DEBUG_TTY, "PORT_ISOPEN found\n"); 293 rio_dprintk(RIO_DEBUG_TTY, "PORT_ISOPEN found\n");
356 } 294 }
357#ifdef MODEM_SUPPORT 295 rio_dprintk(RIO_DEBUG_TTY, "Modem - test for carrier\n");
358 if (Modem) { 296 /*
359 rio_dprintk(RIO_DEBUG_TTY, "Modem - test for carrier\n"); 297 ** ACTION
298 ** insert test for carrier here. -- ???
299 ** I already see that test here. What's the deal? -- REW
300 */
301 if ((PortP->gs.tty->termios->c_cflag & CLOCAL) || (PortP->ModemState & MSVR1_CD)) {
302 rio_dprintk(RIO_DEBUG_TTY, "open(%d) Modem carr on\n", SysPort);
360 /* 303 /*
361 ** ACTION 304 tp->tm.c_state |= CARR_ON;
362 ** insert test for carrier here. -- ??? 305 wakeup((caddr_t) &tp->tm.c_canq);
363 ** I already see that test here. What's the deal? -- REW
364 */ 306 */
365 if ((PortP->gs.tty->termios->c_cflag & CLOCAL) || (PortP->ModemState & MSVR1_CD)) { 307 PortP->State |= RIO_CARR_ON;
366 rio_dprintk(RIO_DEBUG_TTY, "open(%d) Modem carr on\n", SysPort); 308 wake_up_interruptible(&PortP->gs.open_wait);
309 } else { /* no carrier - wait for DCD */
367 /* 310 /*
368 tp->tm.c_state |= CARR_ON; 311 while (!(PortP->gs.tty->termios->c_state & CARR_ON) &&
369 wakeup((caddr_t) &tp->tm.c_canq); 312 !(filp->f_flags & O_NONBLOCK) && !p->RIOHalted )
370 */ 313 */
371 PortP->State |= RIO_CARR_ON; 314 while (!(PortP->State & RIO_CARR_ON) && !(filp->f_flags & O_NONBLOCK) && !p->RIOHalted) {
372 wake_up_interruptible(&PortP->gs.open_wait); 315 rio_dprintk(RIO_DEBUG_TTY, "open(%d) sleeping for carr on\n", SysPort);
373 } else { /* no carrier - wait for DCD */
374
375 /* 316 /*
376 while (!(PortP->gs.tty->termios->c_state & CARR_ON) && 317 PortP->gs.tty->termios->c_state |= WOPEN;
377 !(filp->f_flags & O_NONBLOCK) && !p->RIOHalted )
378 */ 318 */
379 while (!(PortP->State & RIO_CARR_ON) && !(filp->f_flags & O_NONBLOCK) && !p->RIOHalted) { 319 PortP->State |= RIO_WOPEN;
380 320 rio_spin_unlock_irqrestore(&PortP->portSem, flags);
381 rio_dprintk(RIO_DEBUG_TTY, "open(%d) sleeping for carr on\n", SysPort); 321 if (RIODelay(PortP, HUNDRED_MS) == RIO_FAIL) {
322 /*
323 ** ACTION: verify that this is a good thing
324 ** to do here. -- ???
325 ** I think it's OK. -- REW
326 */
327 rio_dprintk(RIO_DEBUG_TTY, "open(%d) sleeping for carr broken by signal\n", SysPort);
328 RIOPreemptiveCmd(p, PortP, FCLOSE);
382 /* 329 /*
383 PortP->gs.tty->termios->c_state |= WOPEN; 330 tp->tm.c_state &= ~WOPEN;
384 */ 331 */
385 PortP->State |= RIO_WOPEN; 332 PortP->State &= ~RIO_WOPEN;
386 rio_spin_unlock_irqrestore(&PortP->portSem, flags); 333 rio_spin_unlock_irqrestore(&PortP->portSem, flags);
387 if (RIODelay(PortP, HUNDRED_MS) == RIO_FAIL) 334 func_exit();
388 { 335 return -EINTR;
389 /*
390 ** ACTION: verify that this is a good thing
391 ** to do here. -- ???
392 ** I think it's OK. -- REW
393 */
394 rio_dprintk(RIO_DEBUG_TTY, "open(%d) sleeping for carr broken by signal\n", SysPort);
395 RIOPreemptiveCmd(p, PortP, FCLOSE);
396 /*
397 tp->tm.c_state &= ~WOPEN;
398 */
399 PortP->State &= ~RIO_WOPEN;
400 rio_spin_unlock_irqrestore(&PortP->portSem, flags);
401 func_exit();
402 return -EINTR;
403 }
404 } 336 }
405 PortP->State &= ~RIO_WOPEN;
406 } 337 }
407 if (p->RIOHalted) 338 PortP->State &= ~RIO_WOPEN;
408 goto bombout;
409 rio_dprintk(RIO_DEBUG_TTY, "Setting RIO_MOPEN\n");
410 PortP->State |= RIO_MOPEN;
411 } else
412#endif
413 {
414 /*
415 ** ACTION
416 ** Direct line open - force carrier (will probably mean
417 ** that sleeping Modem line fubar)
418 */
419 PortP->State |= RIO_LOPEN;
420 } 339 }
340 if (p->RIOHalted)
341 goto bombout;
342 rio_dprintk(RIO_DEBUG_TTY, "Setting RIO_MOPEN\n");
343 PortP->State |= RIO_MOPEN;
421 344
422 if (p->RIOHalted) { 345 if (p->RIOHalted)
423 goto bombout; 346 goto bombout;
424 }
425 347
426 rio_dprintk(RIO_DEBUG_TTY, "high level open done\n"); 348 rio_dprintk(RIO_DEBUG_TTY, "high level open done\n");
427 349
@@ -453,23 +375,21 @@ int riotclose(void *ptr)
453 unsigned long end_time; 375 unsigned long end_time;
454 struct tty_struct *tty; 376 struct tty_struct *tty;
455 unsigned long flags; 377 unsigned long flags;
456 int Modem;
457 int rv = 0; 378 int rv = 0;
458 379
459 rio_dprintk(RIO_DEBUG_TTY, "port close SysPort %d\n", PortP->PortNum); 380 rio_dprintk(RIO_DEBUG_TTY, "port close SysPort %d\n", PortP->PortNum);
460 381
461 /* PortP = p->RIOPortp[SysPort]; */ 382 /* PortP = p->RIOPortp[SysPort]; */
462 rio_dprintk(RIO_DEBUG_TTY, "Port is at address 0x%p\n", PortP); 383 rio_dprintk(RIO_DEBUG_TTY, "Port is at address %p\n", PortP);
463 /* tp = PortP->TtyP; *//* Get tty */ 384 /* tp = PortP->TtyP; *//* Get tty */
464 tty = PortP->gs.tty; 385 tty = PortP->gs.tty;
465 rio_dprintk(RIO_DEBUG_TTY, "TTY is at address 0x%p\n", tty); 386 rio_dprintk(RIO_DEBUG_TTY, "TTY is at address %p\n", tty);
466 387
467 if (PortP->gs.closing_wait) 388 if (PortP->gs.closing_wait)
468 end_time = jiffies + PortP->gs.closing_wait; 389 end_time = jiffies + PortP->gs.closing_wait;
469 else 390 else
470 end_time = jiffies + MAX_SCHEDULE_TIMEOUT; 391 end_time = jiffies + MAX_SCHEDULE_TIMEOUT;
471 392
472 Modem = rio_ismodem(tty);
473 rio_spin_lock_irqsave(&PortP->portSem, flags); 393 rio_spin_lock_irqsave(&PortP->portSem, flags);
474 394
475 /* 395 /*
@@ -493,7 +413,7 @@ int riotclose(void *ptr)
493 /* 413 /*
494 ** clear the open bits for this device 414 ** clear the open bits for this device
495 */ 415 */
496 PortP->State &= (Modem ? ~RIO_MOPEN : ~RIO_LOPEN); 416 PortP->State &= ~RIO_MOPEN;
497 PortP->State &= ~RIO_CARR_ON; 417 PortP->State &= ~RIO_CARR_ON;
498 PortP->ModemState &= ~MSVR1_CD; 418 PortP->ModemState &= ~MSVR1_CD;
499 /* 419 /*
@@ -613,7 +533,7 @@ int riotclose(void *ptr)
613 if (PortP->statsGather) 533 if (PortP->statsGather)
614 PortP->closes++; 534 PortP->closes++;
615 535
616 close_end: 536close_end:
617 /* XXX: Why would a "DELETED" flag be reset here? I'd have 537 /* XXX: Why would a "DELETED" flag be reset here? I'd have
618 thought that a "deleted" flag means that the port was 538 thought that a "deleted" flag means that the port was
619 permanently gone, but here we can make it reappear by it 539 permanently gone, but here we can make it reappear by it
@@ -629,8 +549,7 @@ int riotclose(void *ptr)
629 549
630 550
631 551
632static void RIOClearUp(PortP) 552static void RIOClearUp(struct Port *PortP)
633struct Port *PortP;
634{ 553{
635 rio_dprintk(RIO_DEBUG_TTY, "RIOHalted set\n"); 554 rio_dprintk(RIO_DEBUG_TTY, "RIOHalted set\n");
636 PortP->Config = 0; /* Direct semaphore */ 555 PortP->Config = 0; /* Direct semaphore */
@@ -657,7 +576,7 @@ struct Port *PortP;
657*/ 576*/
658int RIOShortCommand(struct rio_info *p, struct Port *PortP, int command, int len, int arg) 577int RIOShortCommand(struct rio_info *p, struct Port *PortP, int command, int len, int arg)
659{ 578{
660 PKT *PacketP; 579 struct PKT *PacketP;
661 int retries = 20; /* at 10 per second -> 2 seconds */ 580 int retries = 20; /* at 10 per second -> 2 seconds */
662 unsigned long flags; 581 unsigned long flags;
663 582