aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorAlan Cox <alan@lxorguk.ukuu.org.uk>2006-01-16 12:11:50 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2006-01-17 02:31:27 -0500
commita6176eeab0ef1750ce21790a6c6f61ba6c9ffc63 (patch)
tree4b3f55bd031823085acdf731ceffea8a48558db7 /drivers
parent925d70d64bfeccb669c0750943585944abb28b51 (diff)
[PATCH] Remove #if 0 and other long dead code from rio_tty
Signed-off-by: Alan Cox <alan@redhat.com> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/char/rio/riotty.c583
1 files changed, 0 insertions, 583 deletions
diff --git a/drivers/char/rio/riotty.c b/drivers/char/rio/riotty.c
index 5894a25b0113..6379816ed173 100644
--- a/drivers/char/rio/riotty.c
+++ b/drivers/char/rio/riotty.c
@@ -89,16 +89,9 @@ static char *_riotty_c_sccs_ = "@(#)riotty.c 1.3";
89#include "list.h" 89#include "list.h"
90#include "sam.h" 90#include "sam.h"
91 91
92#if 0
93static void ttyseth_pv(struct Port *, struct ttystatics *, struct termios *sg, int);
94#endif
95
96static void RIOClearUp(struct Port *PortP); 92static void RIOClearUp(struct Port *PortP);
97int RIOShortCommand(struct rio_info *p, struct Port *PortP, int command, int len, int arg); 93int RIOShortCommand(struct rio_info *p, struct Port *PortP, int command, int len, int arg);
98 94
99#if 0
100static int RIOCookMode(struct ttystatics *);
101#endif
102 95
103extern int conv_vb[]; /* now defined in ttymgr.c */ 96extern int conv_vb[]; /* now defined in ttymgr.c */
104extern int conv_bv[]; /* now defined in ttymgr.c */ 97extern int conv_bv[]; /* now defined in ttymgr.c */
@@ -226,33 +219,6 @@ int riotopen(struct tty_struct *tty, struct file *filp)
226 ** until the RTA is present then we must spin here waiting for 219 ** until the RTA is present then we must spin here waiting for
227 ** the RTA to boot. 220 ** the RTA to boot.
228 */ 221 */
229#if 0
230 if (!(PortP->HostP->Mapping[PortP->RupNum].Flags & RTA_BOOTED)) {
231 if (PortP->WaitUntilBooted) {
232 rio_dprintk(RIO_DEBUG_TTY, "Waiting for RTA to boot\n");
233 do {
234 if (RIODelay(PortP, HUNDRED_MS) == RIO_FAIL) {
235 rio_dprintk(RIO_DEBUG_TTY, "RTA EINTR in delay \n");
236 func_exit();
237 return -EINTR;
238 }
239 if (repeat_this-- <= 0) {
240 rio_dprintk(RIO_DEBUG_TTY, "Waiting for RTA to boot timeout\n");
241 RIOPreemptiveCmd(p, PortP, FCLOSE);
242 pseterr(EINTR);
243 func_exit();
244 return -EIO;
245 }
246 } while (!(PortP->HostP->Mapping[PortP->RupNum].Flags & RTA_BOOTED));
247 rio_dprintk(RIO_DEBUG_TTY, "RTA has been booted\n");
248 } else {
249 rio_dprintk(RIO_DEBUG_TTY, "RTA never booted\n");
250 pseterr(ENXIO);
251 func_exit();
252 return 0;
253 }
254 }
255#else
256 /* I find the above code a bit hairy. I find the below code 222 /* I find the above code a bit hairy. I find the below code
257 easier to read and shorter. Now, if it works too that would 223 easier to read and shorter. Now, if it works too that would
258 be great... -- REW 224 be great... -- REW
@@ -281,21 +247,10 @@ int riotopen(struct tty_struct *tty, struct file *filp)
281 } 247 }
282 } 248 }
283 rio_dprintk(RIO_DEBUG_TTY, "RTA has been booted\n"); 249 rio_dprintk(RIO_DEBUG_TTY, "RTA has been booted\n");
284#endif
285#if 0
286 tp = PortP->TtyP; /* get tty struct */
287#endif
288 rio_spin_lock_irqsave(&PortP->portSem, flags); 250 rio_spin_lock_irqsave(&PortP->portSem, flags);
289 if (p->RIOHalted) { 251 if (p->RIOHalted) {
290 goto bombout; 252 goto bombout;
291 } 253 }
292#if 0
293 retval = gs_init_port(&PortP->gs);
294 if (retval) {
295 func_exit();
296 return retval;
297 }
298#endif
299 254
300 /* 255 /*
301 ** If the port is in the final throws of being closed, 256 ** If the port is in the final throws of being closed,
@@ -363,11 +318,6 @@ int riotopen(struct tty_struct *tty, struct file *filp)
363 command piggybacks the parameters immediately. 318 command piggybacks the parameters immediately.
364 -- REW */ 319 -- REW */
365 RIOParam(PortP, OPEN, Modem, OK_TO_SLEEP); /* Open the port */ 320 RIOParam(PortP, OPEN, Modem, OK_TO_SLEEP); /* Open the port */
366#if 0
367 /* This delay of 1 second was annoying. I removed it. -- REW */
368 RIODelay(PortP, HUNDRED_MS * 10);
369 RIOParam(PortP, CONFIG, Modem, OK_TO_SLEEP); /* Config the port */
370#endif
371 rio_spin_lock_irqsave(&PortP->portSem, flags); 321 rio_spin_lock_irqsave(&PortP->portSem, flags);
372 322
373 /* 323 /*
@@ -439,9 +389,6 @@ int riotopen(struct tty_struct *tty, struct file *filp)
439 PortP->State |= RIO_WOPEN; 389 PortP->State |= RIO_WOPEN;
440 rio_spin_unlock_irqrestore(&PortP->portSem, flags); 390 rio_spin_unlock_irqrestore(&PortP->portSem, flags);
441 if (RIODelay(PortP, HUNDRED_MS) == RIO_FAIL) 391 if (RIODelay(PortP, HUNDRED_MS) == RIO_FAIL)
442#if 0
443 if (sleep((caddr_t) & tp->tm.c_canqo, TTIPRI | PCATCH))
444#endif
445 { 392 {
446 /* 393 /*
447 ** ACTION: verify that this is a good thing 394 ** ACTION: verify that this is a good thing
@@ -505,10 +452,6 @@ int riotopen(struct tty_struct *tty, struct file *filp)
505*/ 452*/
506int riotclose(void *ptr) 453int riotclose(void *ptr)
507{ 454{
508#if 0
509 register uint SysPort = dev;
510 struct ttystatics *tp; /* pointer to our ttystruct */
511#endif
512 struct Port *PortP = ptr; /* pointer to the port structure */ 455 struct Port *PortP = ptr; /* pointer to the port structure */
513 int deleted = 0; 456 int deleted = 0;
514 int try = -1; /* Disable the timeouts by setting them to -1 */ 457 int try = -1; /* Disable the timeouts by setting them to -1 */
@@ -534,13 +477,6 @@ int riotclose(void *ptr)
534 end_time = jiffies + MAX_SCHEDULE_TIMEOUT; 477 end_time = jiffies + MAX_SCHEDULE_TIMEOUT;
535 478
536 Modem = rio_ismodem(tty); 479 Modem = rio_ismodem(tty);
537#if 0
538 /* What F.CKING cache? Even then, a higly idle multiprocessor,
539 system with large caches this won't work . Better find out when
540 this doesn't work asap, and fix the cause. -- REW */
541
542 RIODelay(PortP, HUNDRED_MS * 10); /* To flush the cache */
543#endif
544 rio_spin_lock_irqsave(&PortP->portSem, flags); 480 rio_spin_lock_irqsave(&PortP->portSem, flags);
545 481
546 /* 482 /*
@@ -703,45 +639,6 @@ int riotclose(void *ptr)
703} 639}
704 640
705 641
706/*
707** decide if we need to use the line discipline.
708** This routine can return one of three values:
709** COOK_RAW if no processing has to be done by the line discipline or the card
710** COOK_WELL if the line discipline must be used to do the processing
711** COOK_MEDIUM if the card can do all the processing necessary.
712*/
713#if 0
714static int RIOCookMode(struct ttystatics *tp)
715{
716 /*
717 ** We can't handle tm.c_mstate != 0 on SCO
718 ** We can't handle mapping
719 ** We can't handle non-ttwrite line disc.
720 ** We can't handle lflag XCASE
721 ** We can handle oflag OPOST & (OCRNL, ONLCR, TAB3)
722 */
723
724#ifdef CHECK
725 CheckTtyP(tp);
726#endif
727 if (!(tp->tm.c_oflag & OPOST)) /* No post processing */
728 return COOK_RAW; /* Raw mode o/p */
729
730 if (tp->tm.c_lflag & XCASE)
731 return COOK_WELL; /* Use line disc */
732
733 if (tp->tm.c_oflag & ~(OPOST | ONLCR | OCRNL | TAB3))
734 return COOK_WELL; /* Use line disc for strange modes */
735
736 if (tp->tm.c_oflag == OPOST) /* If only OPOST is set, do RAW */
737 return COOK_RAW;
738
739 /*
740 ** So, we need to output process!
741 */
742 return COOK_MEDIUM;
743}
744#endif
745 642
746static void RIOClearUp(PortP) 643static void RIOClearUp(PortP)
747struct Port *PortP; 644struct Port *PortP;
@@ -776,11 +673,6 @@ int RIOShortCommand(struct rio_info *p, struct Port *PortP, int command, int len
776 unsigned long flags; 673 unsigned long flags;
777 674
778 rio_dprintk(RIO_DEBUG_TTY, "entering shortcommand.\n"); 675 rio_dprintk(RIO_DEBUG_TTY, "entering shortcommand.\n");
779#ifdef CHECK
780 CheckPortP(PortP);
781 if (len < 1 || len > 2)
782 cprintf(("STUPID LENGTH %d\n", len));
783#endif
784 676
785 if (PortP->State & RIO_DELETED) { 677 if (PortP->State & RIO_DELETED) {
786 rio_dprintk(RIO_DEBUG_TTY, "Short command to deleted RTA ignored\n"); 678 rio_dprintk(RIO_DEBUG_TTY, "Short command to deleted RTA ignored\n");
@@ -852,478 +744,3 @@ int RIOShortCommand(struct rio_info *p, struct Port *PortP, int command, int len
852} 744}
853 745
854 746
855#if 0
856/*
857** This is an ioctl interface. This is the twentieth century. You know what
858** its all about.
859*/
860int riotioctl(struct rio_info *p, struct tty_struct *tty, int cmd, caddr_t arg)
861{
862 register struct Port *PortP;
863 register struct ttystatics *tp;
864 int current;
865 int ParamSemIncremented = 0;
866 int old_oflag, old_cflag, old_iflag, changed, oldcook;
867 int i;
868 unsigned char sio_regs[5]; /* Here be magic */
869 short vpix_cflag;
870 short divisor;
871 int baud;
872 uint SysPort = rio_minor(tty);
873 int Modem = rio_ismodem(tty);
874 int ioctl_processed;
875
876 rio_dprintk(RIO_DEBUG_TTY, "port ioctl SysPort %d command 0x%x argument 0x%x %s\n", SysPort, cmd, arg, Modem ? "Modem" : "tty");
877
878 if (SysPort >= RIO_PORTS) {
879 rio_dprintk(RIO_DEBUG_TTY, "Bad port number %d\n", SysPort);
880 return -ENXIO;
881 }
882
883 PortP = p->RIOPortp[SysPort];
884 tp = PortP->TtyP;
885
886 rio_spin_lock_irqsave(&PortP->portSem, flags);
887
888#ifdef STATS
889 PortP->Stat.IoctlCnt++;
890#endif
891
892 if (PortP->State & RIO_DELETED) {
893 rio_spin_unlock_irqrestore(&PortP->portSem, flags);
894 return -EIO;
895 }
896
897
898 if (p->RIOHalted) {
899 RIOClearUp(PortP);
900 rio_spin_unlock_irqrestore(&PortP->portSem, flags);
901 return -EIO;
902 }
903
904 /*
905 ** Count ioctls for port statistics reporting
906 */
907 if (PortP->statsGather)
908 PortP->ioctls++;
909
910 /*
911 ** Specialix RIO Ioctl calls
912 */
913 switch (cmd) {
914
915 case TCRIOTRIAD:
916 if (arg)
917 PortP->State |= RIO_TRIAD_MODE;
918 else
919 PortP->State &= ~RIO_TRIAD_MODE;
920 /*
921 ** Normally, when istrip is set on a port, a config is
922 ** sent to the RTA instructing the CD1400 to do the
923 ** stripping. In TRIAD mode, the interrupt receive routine
924 ** must do the stripping instead, since it has to detect
925 ** an 8 bit function key sequence. If istrip is set with
926 ** TRIAD mode on(off), and 8 bit data is being read by
927 ** the port, the user then turns TRIAD mode off(on), the RTA
928 ** must be reconfigured (not) to do the stripping.
929 ** Hence we call RIOParam here.
930 */
931 rio_spin_unlock_irqrestore(&PortP->portSem, flags);
932 RIOParam(PortP, CONFIG, Modem, OK_TO_SLEEP);
933 return 0;
934
935 case TCRIOTSTATE:
936 rio_dprintk(RIO_DEBUG_TTY, "tbusy/tstop monitoring %sabled\n", arg ? "en" : "dis");
937 /* MonitorTstate = 0 ; */
938 rio_spin_unlock_irqrestore(&PortP->portSem, flags);
939 RIOParam(PortP, CONFIG, Modem, OK_TO_SLEEP);
940 return 0;
941
942 case TCRIOSTATE: /* current state of Modem input pins */
943 rio_dprintk(RIO_DEBUG_TTY, "TCRIOSTATE\n");
944 if (RIOPreemptiveCmd(p, PortP, MGET) == RIO_FAIL)
945 rio_dprintk(RIO_DEBUG_TTY, "TCRIOSTATE command failed\n");
946 PortP->State |= RIO_BUSY;
947 current = PortP->ModemState;
948 if (copyout((caddr_t) & current, (int) arg, sizeof(current)) == COPYFAIL) {
949 rio_dprintk(RIO_DEBUG_TTY, "Copyout failed\n");
950 rio_spin_unlock_irqrestore(&PortP->portSem, flags);
951 pseterr(EFAULT);
952 }
953 rio_spin_unlock_irqrestore(&PortP->portSem, flags);
954 return 0;
955
956 case TCRIOMBIS: /* Set modem lines */
957 case TCRIOMBIC: /* Clear modem lines */
958 rio_dprintk(RIO_DEBUG_TTY, "TCRIOMBIS/TCRIOMBIC\n");
959 if (cmd == TCRIOMBIS) {
960 uint state;
961 state = (uint) arg;
962 PortP->ModemState |= (ushort) state;
963 PortP->ModemLines = (ulong) arg;
964 if (RIOPreemptiveCmd(p, PortP, MBIS) == RIO_FAIL)
965 rio_dprintk(RIO_DEBUG_TTY, "TCRIOMBIS command failed\n");
966 } else {
967 uint state;
968
969 state = (uint) arg;
970 PortP->ModemState &= ~(ushort) state;
971 PortP->ModemLines = (ulong) arg;
972 if (RIOPreemptiveCmd(p, PortP, MBIC) == RIO_FAIL)
973 rio_dprintk(RIO_DEBUG_TTY, "TCRIOMBIC command failed\n");
974 }
975 PortP->State |= RIO_BUSY;
976 rio_spin_unlock_irqrestore(&PortP->portSem, flags);
977 return 0;
978
979 case TCRIOXPON: /* set Xprint ON string */
980 rio_dprintk(RIO_DEBUG_TTY, "TCRIOXPON\n");
981 if (copyin((int) arg, (caddr_t) PortP->Xprint.XpOn, MAX_XP_CTRL_LEN) == COPYFAIL) {
982 rio_dprintk(RIO_DEBUG_TTY, "Copyin failed\n");
983 PortP->Xprint.XpOn[0] = '\0';
984 rio_spin_unlock_irqrestore(&PortP->portSem, flags);
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;
991
992 case TCRIOXPOFF: /* set Xprint OFF string */
993 rio_dprintk(RIO_DEBUG_TTY, "TCRIOXPOFF\n");
994 if (copyin((int) arg, (caddr_t) PortP->Xprint.XpOff, MAX_XP_CTRL_LEN) == COPYFAIL) {
995 rio_dprintk(RIO_DEBUG_TTY, "Copyin failed\n");
996 PortP->Xprint.XpOff[0] = '\0';
997 rio_spin_unlock_irqrestore(&PortP->portSem, flags);
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;
1004
1005 case TCRIOXPCPS: /* set Xprint CPS string */
1006 rio_dprintk(RIO_DEBUG_TTY, "TCRIOXPCPS\n");
1007 if ((uint) arg > p->RIOConf.MaxXpCps || (uint) arg < p->RIOConf.MinXpCps) {
1008 rio_dprintk(RIO_DEBUG_TTY, "%d CPS out of range\n", arg);
1009 rio_spin_unlock_irqrestore(&PortP->portSem, flags);
1010 pseterr(EINVAL);
1011 return 0;
1012 }
1013 PortP->Xprint.XpCps = (uint) arg;
1014 rio_spin_unlock_irqrestore(&PortP->portSem, flags);
1015 return 0;
1016
1017 case TCRIOXPRINT:
1018 rio_dprintk(RIO_DEBUG_TTY, "TCRIOXPRINT\n");
1019 if (copyout((caddr_t) & PortP->Xprint, (int) arg, sizeof(struct Xprint)) == COPYFAIL) {
1020 rio_spin_unlock_irqrestore(&PortP->portSem, flags);
1021 pseterr(EFAULT);
1022 }
1023 rio_spin_unlock_irqrestore(&PortP->portSem, flags);
1024 return 0;
1025
1026 case TCRIOIXANYON:
1027 rio_dprintk(RIO_DEBUG_TTY, "TCRIOIXANYON\n");
1028 PortP->Config |= RIO_IXANY;
1029 rio_spin_unlock_irqrestore(&PortP->portSem, flags);
1030 return 0;
1031
1032 case TCRIOIXANYOFF:
1033 rio_dprintk(RIO_DEBUG_TTY, "TCRIOIXANYOFF\n");
1034 PortP->Config &= ~RIO_IXANY;
1035 rio_spin_unlock_irqrestore(&PortP->portSem, flags);
1036 return 0;
1037
1038 case TCRIOIXONON:
1039 rio_dprintk(RIO_DEBUG_TTY, "TCRIOIXONON\n");
1040 PortP->Config |= RIO_IXON;
1041 rio_spin_unlock_irqrestore(&PortP->portSem, flags);
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;
1049
1050/*
1051** 15.10.1998 ARG - ESIL 0761 part fix
1052** Added support for CTS and RTS flow control ioctls :
1053*/
1054 case TCRIOCTSFLOWEN:
1055 rio_dprintk(RIO_DEBUG_TTY, "TCRIOCTSFLOWEN\n");
1056 PortP->Config |= RIO_CTSFLOW;
1057 rio_spin_unlock_irqrestore(&PortP->portSem, flags);
1058 RIOParam(PortP, CONFIG, Modem, OK_TO_SLEEP);
1059 return 0;
1060
1061 case TCRIOCTSFLOWDIS:
1062 rio_dprintk(RIO_DEBUG_TTY, "TCRIOCTSFLOWDIS\n");
1063 PortP->Config &= ~RIO_CTSFLOW;
1064 rio_spin_unlock_irqrestore(&PortP->portSem, flags);
1065 RIOParam(PortP, CONFIG, Modem, OK_TO_SLEEP);
1066 return 0;
1067
1068 case TCRIORTSFLOWEN:
1069 rio_dprintk(RIO_DEBUG_TTY, "TCRIORTSFLOWEN\n");
1070 PortP->Config |= RIO_RTSFLOW;
1071 rio_spin_unlock_irqrestore(&PortP->portSem, flags);
1072 RIOParam(PortP, CONFIG, Modem, OK_TO_SLEEP);
1073 return 0;
1074
1075 case TCRIORTSFLOWDIS:
1076 rio_dprintk(RIO_DEBUG_TTY, "TCRIORTSFLOWDIS\n");
1077 PortP->Config &= ~RIO_RTSFLOW;
1078 rio_spin_unlock_irqrestore(&PortP->portSem, flags);
1079 RIOParam(PortP, CONFIG, Modem, OK_TO_SLEEP);
1080 return 0;
1081
1082/* end ESIL 0761 part fix */
1083
1084 }
1085
1086
1087 /* Lynx IOCTLS */
1088 switch (cmd) {
1089 case TIOCSETP:
1090 case TIOCSETN:
1091 case OTIOCSETP:
1092 case OTIOCSETN:
1093 ioctl_processed++;
1094 ttyseth(PortP, tp, (struct old_sgttyb *) arg);
1095 break;
1096 case TCSETA:
1097 case TCSETAW:
1098 case TCSETAF:
1099 ioctl_processed++;
1100 rio_dprintk(RIO_DEBUG_TTY, "NON POSIX ioctl\n");
1101 ttyseth_pv(PortP, tp, (struct termios *) arg, 0);
1102 break;
1103 case TCSETAP: /* posix tcsetattr() */
1104 case TCSETAWP: /* posix tcsetattr() */
1105 case TCSETAFP: /* posix tcsetattr() */
1106 rio_dprintk(RIO_DEBUG_TTY, "NON POSIX SYSV ioctl\n");
1107 ttyseth_pv(PortP, tp, (struct termios *) arg, 1);
1108 ioctl_processed++;
1109 break;
1110 }
1111
1112 /*
1113 ** If its any of the commands that require the port to be in the
1114 ** non-busy state wait until all output has drained
1115 */
1116 if (!ioctl_processed)
1117 switch (cmd) {
1118 case TCSETAW:
1119 case TCSETAF:
1120 case TCSETA:
1121 case TCSBRK:
1122#define OLD_POSIX ('x' << 8)
1123#define OLD_POSIX_SETA (OLD_POSIX | 2)
1124#define OLD_POSIX_SETAW (OLD_POSIX | 3)
1125#define OLD_POSIX_SETAF (OLD_POSIX | 4)
1126#define NEW_POSIX (('i' << 24) | ('X' << 16))
1127#define NEW_POSIX_SETA (NEW_POSIX | 2)
1128#define NEW_POSIX_SETAW (NEW_POSIX | 3)
1129#define NEW_POSIX_SETAF (NEW_POSIX | 4)
1130 case OLD_POSIX_SETA:
1131 case OLD_POSIX_SETAW:
1132 case OLD_POSIX_SETAF:
1133 case NEW_POSIX_SETA:
1134 case NEW_POSIX_SETAW:
1135 case NEW_POSIX_SETAF:
1136#ifdef TIOCSETP
1137 case TIOCSETP:
1138#endif
1139 case TIOCSETD:
1140 case TIOCSETN:
1141 rio_dprintk(RIO_DEBUG_TTY, "wait for non-BUSY, semaphore set\n");
1142 /*
1143 ** Wait for drain here, at least as far as the double buffer
1144 ** being empty.
1145 */
1146 /* XXX Does the above comment mean that this has
1147 still to be implemented? -- REW */
1148 /* XXX Is the locking OK together with locking
1149 in txenable? (Deadlock?) -- REW */
1150
1151 RIOTxEnable((char *) PortP);
1152 break;
1153 default:
1154 break;
1155 }
1156
1157 old_cflag = tp->tm.c_cflag;
1158 old_iflag = tp->tm.c_iflag;
1159 old_oflag = tp->tm.c_oflag;
1160 oldcook = PortP->CookMode;
1161
1162 if (p->RIOHalted) {
1163 RIOClearUp(PortP);
1164 rio_spin_unlock_irqrestore(&PortP->portSem, flags);
1165 pseterr(EIO);
1166 return 0;
1167 }
1168
1169 PortP->FlushCmdBodge = 0;
1170
1171 /*
1172 ** If the port is locked, and it is reconfigured, we want
1173 ** to restore the state of the tty structure so the change is NOT
1174 ** made.
1175 */
1176 if (PortP->Lock) {
1177 tp->tm.c_iflag = PortP->StoredTty.iflag;
1178 tp->tm.c_oflag = PortP->StoredTty.oflag;
1179 tp->tm.c_cflag = PortP->StoredTty.cflag;
1180 tp->tm.c_lflag = PortP->StoredTty.lflag;
1181 tp->tm.c_line = PortP->StoredTty.line;
1182 for (i = 0; i < NCC + 1; i++)
1183 tp->tm.c_cc[i] = PortP->StoredTty.cc[i];
1184 } else {
1185 /*
1186 ** If the port is set to store the parameters, and it is
1187 ** reconfigured, we want to save the current tty struct so it
1188 ** may be restored on the next open.
1189 */
1190 if (PortP->Store) {
1191 PortP->StoredTty.iflag = tp->tm.c_iflag;
1192 PortP->StoredTty.oflag = tp->tm.c_oflag;
1193 PortP->StoredTty.cflag = tp->tm.c_cflag;
1194 PortP->StoredTty.lflag = tp->tm.c_lflag;
1195 PortP->StoredTty.line = tp->tm.c_line;
1196 for (i = 0; i < NCC + 1; i++)
1197 PortP->StoredTty.cc[i] = tp->tm.c_cc[i];
1198 }
1199 }
1200
1201 changed = (tp->tm.c_cflag != old_cflag) || (tp->tm.c_iflag != old_iflag) || (tp->tm.c_oflag != old_oflag);
1202
1203 PortP->CookMode = RIOCookMode(tp); /* Set new cooking mode */
1204
1205 rio_dprintk(RIO_DEBUG_TTY, "RIOIoctl changed %d newcook %d oldcook %d\n", changed, PortP->CookMode, oldcook);
1206
1207#ifdef MODEM_SUPPORT
1208 /*
1209 ** kludge to force CARR_ON if CLOCAL set
1210 */
1211 if ((tp->tm.c_cflag & CLOCAL) || (PortP->ModemState & MSVR1_CD)) {
1212 tp->tm.c_state |= CARR_ON;
1213 wakeup((caddr_t) & tp->tm.c_canq);
1214 }
1215#endif
1216
1217 if (p->RIOHalted) {
1218 RIOClearUp(PortP);
1219 rio_spin_unlock_irqrestore(&PortP->portSem, flags);
1220 pseterr(EIO);
1221 return 0;
1222 }
1223 /*
1224 ** Re-configure if modes or cooking have changed
1225 */
1226 if (changed || oldcook != PortP->CookMode || (ioctl_processed)) {
1227 rio_spin_unlock_irqrestore(&PortP->portSem, flags);
1228 rio_dprintk(RIO_DEBUG_TTY, "Ioctl changing the PORT settings\n");
1229 RIOParam(PortP, CONFIG, Modem, OK_TO_SLEEP);
1230 rio_spin_lock_irqsave(&PortP->portSem, flags);
1231 }
1232
1233 if (p->RIOHalted) {
1234 rio_spin_unlock_irqrestore(&PortP->portSem, flags);
1235 RIOClearUp(PortP);
1236 pseterr(EIO);
1237 return 0;
1238 }
1239 rio_spin_unlock_irqrestore(&PortP->portSem, flags);
1240 return 0;
1241}
1242
1243/*
1244 ttyseth -- set hardware dependent tty settings
1245*/
1246void ttyseth(PortP, s, sg)
1247struct Port *PortP;
1248struct ttystatics *s;
1249struct old_sgttyb *sg;
1250{
1251 struct old_sgttyb *tsg;
1252 struct termios *tp = &s->tm;
1253
1254 tsg = &s->sg;
1255
1256 if (sg->sg_flags & (EVENP | ODDP)) {
1257 tp->c_cflag &= PARENB;
1258 if (sg->sg_flags & EVENP) {
1259 if (sg->sg_flags & ODDP) {
1260 tp->c_cflag &= V_CS7;
1261 tp->c_cflag &= ~PARENB;
1262 } else {
1263 tp->c_cflag &= V_CS7;
1264 tp->c_cflag &= PARENB;
1265 tp->c_cflag &= PARODD;
1266 }
1267 } else if (sg->sg_flags & ODDP) {
1268 tp->c_cflag &= V_CS7;
1269 tp->c_cflag &= PARENB;
1270 tp->c_cflag &= PARODD;
1271 } else {
1272 tp->c_cflag &= V_CS7;
1273 tp->c_cflag &= PARENB;
1274 }
1275 }
1276/*
1277 * Use ispeed as the desired speed. Most implementations don't handle
1278 * separate input and output speeds very well. If the RIO handles this,
1279 * I will have to use separate sets of flags to store them in the
1280 * Port structure.
1281 */
1282 if (!sg->sg_ospeed)
1283 sg->sg_ospeed = sg->sg_ispeed;
1284 else
1285 sg->sg_ispeed = sg->sg_ospeed;
1286 if (sg->sg_ispeed > V_EXTB)
1287 sg->sg_ispeed = V_EXTB;
1288 if (sg->sg_ispeed < V_B0)
1289 sg->sg_ispeed = V_B0;
1290 *tsg = *sg;
1291 tp->c_cflag = (tp->c_cflag & ~V_CBAUD) | conv_bv[(int) sg->sg_ispeed];
1292}
1293
1294/*
1295 ttyseth_pv -- set hardware dependent tty settings using either the
1296 POSIX termios structure or the System V termio structure.
1297 sysv = 0 => (POSIX): struct termios *sg
1298 sysv != 0 => (System V): struct termio *sg
1299*/
1300static void ttyseth_pv(PortP, s, sg, sysv)
1301struct Port *PortP;
1302struct ttystatics *s;
1303struct termios *sg;
1304int sysv;
1305{
1306 int speed;
1307 unsigned char csize;
1308 unsigned char cread;
1309 unsigned int lcr_flags;
1310 int ps;
1311
1312 if (sysv) {
1313 /* sg points to a System V termio structure */
1314 csize = ((struct termio *) sg)->c_cflag & CSIZE;
1315 cread = ((struct termio *) sg)->c_cflag & CREAD;
1316 speed = conv_vb[((struct termio *) sg)->c_cflag & V_CBAUD];
1317 } else {
1318 /* sg points to a POSIX termios structure */
1319 csize = sg->c_cflag & CSIZE;
1320 cread = sg->c_cflag & CREAD;
1321 speed = conv_vb[sg->c_cflag & V_CBAUD];
1322 }
1323 if (s->sg.sg_ispeed != speed || s->sg.sg_ospeed != speed) {
1324 s->sg.sg_ispeed = speed;
1325 s->sg.sg_ospeed = speed;
1326 s->tm.c_cflag = (s->tm.c_cflag & ~V_CBAUD) | conv_bv[(int) s->sg.sg_ispeed];
1327 }
1328}
1329#endif