Patch to the serial driver --- please apply!

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
Date: Saturday, October 24, 1992 - 3:46 pm

Well, I finally tracked down the source of many (but probably not all)
of the problems which people were complaining about.  There were too
problems.  The first was that change_speed was being called in the wrong
place, so that if you were using the UART at 2400 baud for the first
time after bootup, the UART would not be initialized correctly.  (Thanks
you, Linus, for calling this bug to my attention!)

The second bug had to do with how the serial driver handled programs
which set the baud rate to zero temporarily to force DTR down.  Instead
of just dropping DTR, the old serial driver was shutting down the UART,
which caused DTR to be dropped *permanently*.  (Since I normally use
kermit instead of minicom, I didn't notice this in my testing, because
kermit doesn't try setting the baud rate to zero.)

Bugs regarding internal modems (or possibly some wierd serial boards)
not being properly detected at boot time aren't addressed in this patch,
but that is mostly harmless.  Bugs where a SCSI board is mistaken from a
UART are also not addressed here, although again it is mostly harmless.
People who are paranoid may wish to comment out the last two lines in
the rs_table[] structure in serial.c, however.

Linus, could you make sure these patches make it into the next release
of the kernel?  Thanks!

                                                        - Ted

Priority: urgent (especially for those who have reported problems with 
                        the serial driver)

*** 1.1 1992/10/24 12:37:29
--- serial.c    1992/10/24 14:54:10
***************
*** 405,412 ****
--- 405,414 ----
        struct async_struct *info;
        unsigned char mcr;
  
+ #ifdef notdef
        printk("throttle tty%d: %d (%d, %d)....\n", DEV_TO_SL(tty->line),
               status, LEFT(&tty->read_q), LEFT(&tty->secondary));
+ #endif
        switch (status) {
        case TTY_THROTTLE_RQ_FULL:
                info = rs_table + DEV_TO_SL(tty->line);
***************
*** 556,562 ****
        struct async_struct * info;
        unsigned short port;
        int     quot = 0;
!       unsigned cflag,cval;
        int     i;
  
        if (line >= NR_PORTS)
--- 558,564 ----
        struct async_struct * info;
        unsigned short port;
        int     quot = 0;
!       unsigned cflag,cval,mcr;
        int     i;
  
        if (line >= NR_PORTS)
***************
*** 589,596 ****
                quot = 0;
                info->timeout = 0;
        }
!       if (!quot) {
!               shutdown(info);
                return;
        }
        /* byte size and parity */
--- 591,601 ----
                quot = 0;
                info->timeout = 0;
        }
!       mcr = inb(UART_MCR + port);
!       if (quot) 
!               outb(mcr | UART_MCR_DTR, UART_MCR + port);
!       else {
!               outb(mcr & ~UART_MCR_DTR, UART_MCR + port);
                return;
        }
        /* byte size and parity */
***************
*** 844,849 ****
--- 849,855 ----
                IRQ_ISR[irq] = ISR;
        }
        startup(info);
+       change_speed(info->line);
        return 0;
  }
  
***************
*** 950,957 ****
                }
        } else
                info->type = PORT_8250;
-       startup(info);
-       change_speed(info->line);
        shutdown(info);
  }
  
--- 956,961 ----
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Patch to the serial driver --- please apply!, Theodore Ts'o, (Sat Oct 24, 3:46 pm)