Hi,
This patches mainly makes the RIO driver work better with modems. Thing
like carrier detect work now. Also a small fixes to generic serial.
Patrick
diff -u -r --new-file ./linux-2.2.18-pre17.clean/drivers/char/generic_serial.c /usr/src/16/linux-2.2.18-pre17.rio/drivers/char/generic_serial.c
--- linux-2.2.18-pre17.clean/drivers/char/generic_serial.c Thu Oct 19 15:27:26 2000
+++ linux-2.2.18-pre17.rio/drivers/char/generic_serial.c Thu Oct 19 11:28:23 2000
@@ -367,7 +367,7 @@
struct gs_port *port = ptr;
long end_jiffies;
int jiffies_to_transmit, charsleft = 0, rv = 0;
- int to, rcib;
+ int rcib;
func_enter();
@@ -391,6 +391,7 @@
return rv;
}
/* stop trying: now + twice the time it would normally take + seconds */
+ if (timeout == 0) timeout = MAX_SCHEDULE_TIMEOUT;
end_jiffies = jiffies;
if (timeout != MAX_SCHEDULE_TIMEOUT)
end_jiffies += port->baud?(2 * rcib * 10 * HZ / port->baud):0;
@@ -399,11 +400,9 @@
gs_dprintk (GS_DEBUG_FLUSH, "now=%lx, end=%lx (%ld).\n",
jiffies, end_jiffies, end_jiffies-jiffies);
- to = 100;
/* the expression is actually jiffies < end_jiffies, but that won't
work around the wraparound. Tricky eh? */
- while (to-- &&
- (charsleft = gs_real_chars_in_buffer (port->tty)) &&
+ while ((charsleft = gs_real_chars_in_buffer (port->tty)) &&
time_after (end_jiffies, jiffies)) {
/* Units check:
chars * (bits/char) * (jiffies /sec) / (bits/sec) = jiffies!
diff -u -r --new-file ./linux-2.2.18-pre17.clean/drivers/char/rio/linux_compat.h /usr/src/16/linux-2.2.18-pre17.rio/drivers/char/rio/linux_compat.h
--- linux-2.2.18-pre17.clean/drivers/char/rio/linux_compat.h Thu Oct 19 15:27:27 2000
+++ linux-2.2.18-pre17.rio/drivers/char/rio/linux_compat.h Thu Oct 19 11:59:45 2000
@@ -16,11 +16,13 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
+#include <asm/hardirq.h>
+
#define disable(oldspl) save_flags (oldspl)
#define restore(oldspl) restore_flags (oldspl)
-#define sysbrk(x) kmalloc ((x), GFP_KERNEL)
+#define sysbrk(x) kmalloc ((x),in_interrupt()? GFP_ATOMIC : GFP_KERNEL)
#define sysfree(p,size) kfree ((p))
#define WBYTE(p,v) writeb(v, &p)
diff -u -r --new-file ./linux-2.2.18-pre17.clean/drivers/char/rio/rio_linux.c /usr/src/16/linux-2.2.18-pre17.rio/drivers/char/rio/rio_linux.c
--- linux-2.2.18-pre17.clean/drivers/char/rio/rio_linux.c Thu Oct 19 15:27:27 2000
+++ linux-2.2.18-pre17.rio/drivers/char/rio/rio_linux.c Thu Oct 19 11:28:23 2000
@@ -386,8 +386,8 @@
int rio_ismodem (kdev_t device)
{
- return (MAJOR (device) != RIO_NORMAL_MAJOR0) &&
- (MAJOR (device) != RIO_NORMAL_MAJOR1);
+ return (MAJOR (device) == RIO_NORMAL_MAJOR0) ||
+ (MAJOR (device) == RIO_NORMAL_MAJOR1);
}
@@ -731,20 +731,22 @@
static int rio_ioctl (struct tty_struct * tty, struct file * filp,
unsigned int cmd, unsigned long arg)
{
-#if 0
int rc;
- struct rio_port *port = tty->driver_data;
+ struct Port *PortP;
int ival;
- /* func_enter2(); */
+ func_enter();
+ PortP = (struct Port *)tty->driver_data;
rc = 0;
switch (cmd) {
+#if 0
case TIOCGSOFTCAR:
rc = Put_user(((tty->termios->c_cflag & CLOCAL) ? 1 : 0),
(unsigned int *) arg);
break;
+#endif
case TIOCSSOFTCAR:
if ((rc = verify_area(VERIFY_READ, (void *) arg,
sizeof(int))) == 0) {
@@ -757,13 +759,14 @@
case TIOCGSERIAL:
if ((rc = verify_area(VERIFY_WRITE, (void *) arg,
sizeof(struct serial_struct))) == 0)
- gs_getserial(&port->gs, (struct serial_struct *) arg);
+ gs_getserial(&PortP->gs, (struct serial_struct *) arg);
break;
case TIOCSSERIAL:
if ((rc = verify_area(VERIFY_READ, (void *) arg,
sizeof(struct serial_struct))) == 0)
- rc = gs_setserial(&port->gs, (struct serial_struct *) arg);
+ rc = gs_setserial(&PortP->gs, (struct serial_struct *) arg);
break;
+#if 0
case TIOCMGET:
if ((rc = verify_area(VERIFY_WRITE, (void *) arg,
sizeof(unsigned int))) == 0) {
@@ -795,17 +798,13 @@
((ival & TIOCM_RTS) ? 1 : 0));
}
break;
-
+#endif
default:
rc = -ENOIOCTLCMD;
break;
}
- /* func_exit(); */
+ func_exit();
return rc;
-#else
- return -ENOIOCTLCMD;
-#endif
-
}
@@ -1276,6 +1275,7 @@
hp->Type = RIO_PCI;
hp->Copy = rio_pcicopy;
hp->Mode = RIO_PCI_BOOT_FROM_RAM;
+ hp->HostLock = SPIN_LOCK_UNLOCKED;
rio_dprintk (RIO_DEBUG_PROBE, "Ivec: %x\n", hp->Ivec);
rio_dprintk (RIO_DEBUG_PROBE, "Mode: %x\n", hp->Mode);
@@ -1331,6 +1331,7 @@
* Moreover, the ISA card will work with the
* special PCI copy anyway. -- REW */
hp->Mode = 0;
+ hp->HostLock = SPIN_LOCK_UNLOCKED;
vpdp = get_VPD_PROM (hp);
rio_dprintk (RIO_DEBUG_PROBE, "Got VPD ROM\n");
diff -u -r --new-file ./linux-2.2.18-pre17.clean/drivers/char/rio/rio_linux.h /usr/src/16/linux-2.2.18-pre17.rio/drivers/char/rio/rio_linux.h
--- linux-2.2.18-pre17.clean/drivers/char/rio/rio_linux.h Thu Oct 19 15:27:27 2000
+++ linux-2.2.18-pre17.rio/drivers/char/rio/rio_linux.h Thu Oct 19 11:59:45 2000
@@ -94,22 +94,22 @@
recompile.... */
#if 1
#define rio_spin_lock_irqsave(sem, flags) do { \
+ spin_lock_irqsave(sem, flags);\
rio_dprintk (RIO_DEBUG_SPINLOCK, "spinlockirqsave: %p %s:%d\n", \
sem, __FILE__, __LINE__);\
- spin_lock_irqsave(sem, flags);\
} while (0)
#define rio_spin_unlock_irqrestore(sem, flags) do { \
rio_dprintk (RIO_DEBUG_SPINLOCK, "spinunlockirqrestore: %p %s:%d\n",\
sem, __FILE__, __LINE__);\
- spin_unlock_irqrestore(sem, flags);\
+ spin_unlock_irqrestore(sem, flags);\
} while (0)
#define rio_spin_lock(sem) do { \
+ spin_lock(sem);\
rio_dprintk (RIO_DEBUG_SPINLOCK, "spinlock: %p %s:%d\n",\
sem, __FILE__, __LINE__);\
- spin_lock(sem);\
} while (0)
#define rio_spin_unlock(sem) do { \
diff -u -r --new-file ./linux-2.2.18-pre17.clean/drivers/char/rio/rioboot.c /usr/src/16/linux-2.2.18-pre17.rio/drivers/char/rio/rioboot.c
--- linux-2.2.18-pre17.clean/drivers/char/rio/rioboot.c Thu Oct 19 15:27:27 2000
+++ linux-2.2.18-pre17.rio/drivers/char/rio/rioboot.c Thu Oct 19 11:43:51 2000
@@ -38,11 +38,11 @@
#include <linux/module.h>
#include <linux/malloc.h>
#include <linux/errno.h>
+#include <linux/interrupt.h>
#include <asm/io.h>
#include <asm/system.h>
#include <asm/string.h>
#include <asm/semaphore.h>
-
#include <linux/termios.h>
#include <linux/serial.h>
diff -u -r --new-file ./linux-2.2.18-pre17.clean/drivers/char/rio/riocmd.c /usr/src/16/linux-2.2.18-pre17.rio/drivers/char/rio/riocmd.c
--- linux-2.2.18-pre17.clean/drivers/char/rio/riocmd.c Thu Oct 19 15:27:27 2000
+++ linux-2.2.18-pre17.rio/drivers/char/rio/riocmd.c Thu Oct 19 13:29:51 2000
@@ -38,6 +38,9 @@
#include <linux/module.h>
#include <linux/malloc.h>
#include <linux/errno.h>
+#include <linux/smp.h>
+#include <linux/interrupt.h>
+#include <asm/ptrace.h>
#include <asm/io.h>
#include <asm/system.h>
#include <asm/string.h>
@@ -80,7 +83,6 @@
#include "control.h"
#include "cirrus.h"
-
static struct IdentifyRta IdRta;
static struct KillNeighbour KillUnit;
@@ -622,7 +624,8 @@
struct CmdBlk *CmdBlkP;
CmdBlkP = (struct CmdBlk *)sysbrk(sizeof(struct CmdBlk));
- bzero(CmdBlkP, sizeof(struct CmdBlk));
+ if (CmdBlkP)
+ bzero(CmdBlkP, sizeof(struct CmdBlk));
return CmdBlkP;
}
diff -u -r --new-file ./linux-2.2.18-pre17.clean/drivers/char/rio/rioinit.c /usr/src/16/linux-2.2.18-pre17.rio/drivers/char/rio/rioinit.c
--- linux-2.2.18-pre17.clean/drivers/char/rio/rioinit.c Thu Oct 19 15:27:27 2000
+++ linux-2.2.18-pre17.rio/drivers/char/rio/rioinit.c Thu Oct 19 11:28:23 2000
@@ -1446,7 +1446,7 @@
}
RIODefaultName(p, HostP, rup);
}
- HostP->UnixRups[rup].RupLock = -1;
+ HostP->UnixRups[rup].RupLock = SPIN_LOCK_UNLOCKED;
}
}
}
diff -u -r --new-file ./linux-2.2.18-pre17.clean/drivers/char/rio/riotable.c /usr/src/16/linux-2.2.18-pre17.rio/drivers/char/rio/riotable.c
--- linux-2.2.18-pre17.clean/drivers/char/rio/riotable.c Thu Oct 19 15:27:27 2000
+++ linux-2.2.18-pre17.rio/drivers/char/rio/riotable.c Thu Oct 19 11:45:00 2000
@@ -37,6 +37,8 @@
#include <linux/module.h>
#include <linux/malloc.h>
#include <linux/errno.h>
+#include <linux/interrupt.h>
+
#include <asm/io.h>
#include <asm/system.h>
#include <asm/string.h>
diff -u -r --new-file ./linux-2.2.18-pre17.clean/drivers/char/rio/riotty.c /usr/src/16/linux-2.2.18-pre17.rio/drivers/char/rio/riotty.c
--- linux-2.2.18-pre17.clean/drivers/char/rio/riotty.c Thu Oct 19 15:27:27 2000
+++ linux-2.2.18-pre17.rio/drivers/char/rio/riotty.c Thu Oct 19 11:28:23 2000
@@ -451,8 +451,11 @@
PortP->gs.tty->termios->c_state |= WOPEN;
*/
PortP->State |= RIO_WOPEN;
+ rio_spin_unlock_irqrestore(&PortP->portSem, flags);
+ if (RIODelay (&PortP, HUNDRED_MS) == RIO_FAIL)
#if 0
if ( sleep((caddr_t)&tp->tm.c_canqo, TTIPRI|PCATCH))
+#endif
{
/*
** ACTION: verify that this is a good thing
@@ -470,7 +473,6 @@
func_exit ();
return -EINTR;
}
-#endif
}
PortP->State &= ~RIO_WOPEN;
}
@@ -526,8 +528,10 @@
#endif
struct Port *PortP =ptr; /* pointer to the port structure */
int deleted = 0;
- int try = 25;
- int repeat_this = 0xff;
+ int try = -1; /* Disable the timeouts by setting them to -1 */
+ int repeat_this = -1; /* Congrats to those having 15 years of
+ uptime! (You get to break the driver.) */
+ long end_time;
struct tty_struct * tty;
unsigned long flags;
int Modem;
@@ -540,6 +544,12 @@
/* tp = PortP->TtyP;*/ /* Get tty */
tty = PortP->gs.tty;
rio_dprintk (RIO_DEBUG_TTY, "TTY is at address 0x%x\n",(int)tty);
+
+ if (PortP->gs.closing_wait)
+ end_time = jiffies + PortP->gs.closing_wait;
+ else
+ end_time = jiffies + MAX_SCHEDULE_TIMEOUT;
+
Modem = rio_ismodem(tty->device);
#if 0
/* What F.CKING cache? Even then, a higly idle multiprocessor,
@@ -572,7 +582,8 @@
** clear the open bits for this device
*/
PortP->State &= (Modem ? ~RIO_MOPEN : ~RIO_LOPEN);
-
+ PortP->State &= ~RIO_CARR_ON;
+ PortP->ModemState &= ~MSVR1_CD;
/*
** If the device was open as both a Modem and a tty line
** then we need to wimp out here, as the port has not really
@@ -604,7 +615,7 @@
*/
rio_dprintk (RIO_DEBUG_TTY, "Timeout 1 starts\n");
-#if 0
+
if (!deleted)
while ( (PortP->InUse != NOT_INUSE) && !p->RIOHalted &&
(PortP->TxBufferIn != PortP->TxBufferOut) ) {
@@ -625,7 +636,7 @@
}
rio_spin_lock_irqsave(&PortP->portSem, flags);
}
-#endif
+
PortP->TxBufferIn = PortP->TxBufferOut = 0;
repeat_this = 0xff;
@@ -659,9 +670,9 @@
}
if (!deleted)
- while (try && (PortP->PortState & PORT_ISOPEN)) {
+ while (PortP->PortState & PORT_ISOPEN) {
try--;
- if (try == 0) {
+ if (time_after (jiffies, end_time)) {
rio_dprintk (RIO_DEBUG_TTY, "Run out of tries - force the bugger shut!\n" );
RIOPreemptiveCmd(p, PortP,FCLOSE);
break;
@@ -673,7 +684,11 @@
RIOClearUp( PortP );
goto close_end;
}
- RIODelay_ni(PortP, HUNDRED_MS);
+ if (RIODelay(PortP, HUNDRED_MS) == RIO_FAIL) {
+ rio_dprintk (RIO_DEBUG_TTY, "RTA EINTR in delay \n");
+ RIOPreemptiveCmd(p, PortP,FCLOSE);
+ break;
+ }
}
rio_spin_lock_irqsave(&PortP->portSem, flags);
rio_dprintk (RIO_DEBUG_TTY, "Close: try was %d on completion\n", try );
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/
This archive was generated by hypermail 2b29 : Mon Oct 23 2000 - 21:00:14 EST