X-Git-Url: http://ftp.safe.ca/?a=blobdiff_plain;f=drivers%2Fserial%2Ficom.c;h=71e6a24d8c28f18b8c6420ca5ffab0fef011651d;hb=5f015a5b28c75bb6cc5158640db58689b1ee1b51;hp=c112b32764e8ceb3045ebcbe7933d25eb7d3aa22;hpb=6d283d271674b1127881ebf082266a2c3fe6e0e4;p=safe%2Fjmp%2Flinux-2.6 diff --git a/drivers/serial/icom.c b/drivers/serial/icom.c index c112b32..71e6a24 100644 --- a/drivers/serial/icom.c +++ b/drivers/serial/icom.c @@ -24,7 +24,6 @@ */ #define SERIAL_DO_RESTART #include -#include #include #include #include @@ -56,7 +55,6 @@ #include #include -#include #include #include #include @@ -730,19 +728,20 @@ static void recv_interrupt(u16 port_int_reg, struct icom_port *icom_port) unsigned short int status; struct uart_icount *icount; unsigned long offset; + unsigned char flag; trace(icom_port, "RCV_COMPLETE", 0); rcv_buff = icom_port->next_rcv; status = cpu_to_le16(icom_port->statStg->rcv[rcv_buff].flags); while (status & SA_FL_RCV_DONE) { + int first = -1; trace(icom_port, "FID_STATUS", status); count = cpu_to_le16(icom_port->statStg->rcv[rcv_buff].leLength); + count = tty_buffer_request_room(tty, count); trace(icom_port, "RCV_COUNT", count); - if (count > (TTY_FLIPBUF_SIZE - tty->flip.count)) - count = TTY_FLIPBUF_SIZE - tty->flip.count; trace(icom_port, "REAL_COUNT", count); @@ -750,15 +749,10 @@ static void recv_interrupt(u16 port_int_reg, struct icom_port *icom_port) cpu_to_le32(icom_port->statStg->rcv[rcv_buff].leBuffer) - icom_port->recv_buf_pci; - memcpy(tty->flip.char_buf_ptr,(unsigned char *) - ((unsigned long)icom_port->recv_buf + offset), count); - + /* Block copy all but the last byte as this may have status */ if (count > 0) { - tty->flip.count += count - 1; - tty->flip.char_buf_ptr += count - 1; - - memset(tty->flip.flag_buf_ptr, 0, count); - tty->flip.flag_buf_ptr += count - 1; + first = icom_port->recv_buf[offset]; + tty_insert_flip_string(tty, icom_port->recv_buf + offset, count - 1); } icount = &icom_port->uart_port.icount; @@ -766,12 +760,14 @@ static void recv_interrupt(u16 port_int_reg, struct icom_port *icom_port) /* Break detect logic */ if ((status & SA_FLAGS_FRAME_ERROR) - && (tty->flip.char_buf_ptr[0] == 0x00)) { + && first == 0) { status &= ~SA_FLAGS_FRAME_ERROR; status |= SA_FLAGS_BREAK_DET; trace(icom_port, "BREAK_DET", 0); } + flag = TTY_NORMAL; + if (status & (SA_FLAGS_BREAK_DET | SA_FLAGS_PARITY_ERROR | SA_FLAGS_FRAME_ERROR | SA_FLAGS_OVERRUN)) { @@ -798,33 +794,26 @@ static void recv_interrupt(u16 port_int_reg, struct icom_port *icom_port) status &= icom_port->read_status_mask; if (status & SA_FLAGS_BREAK_DET) { - *tty->flip.flag_buf_ptr = TTY_BREAK; + flag = TTY_BREAK; } else if (status & SA_FLAGS_PARITY_ERROR) { trace(icom_port, "PARITY_ERROR", 0); - *tty->flip.flag_buf_ptr = TTY_PARITY; + flag = TTY_PARITY; } else if (status & SA_FLAGS_FRAME_ERROR) - *tty->flip.flag_buf_ptr = TTY_FRAME; - - if (status & SA_FLAGS_OVERRUN) { - /* - * Overrun is special, since it's - * reported immediately, and doesn't - * affect the current character - */ - if (tty->flip.count < TTY_FLIPBUF_SIZE) { - tty->flip.count++; - tty->flip.flag_buf_ptr++; - tty->flip.char_buf_ptr++; - *tty->flip.flag_buf_ptr = TTY_OVERRUN; - } - } + flag = TTY_FRAME; + } - tty->flip.flag_buf_ptr++; - tty->flip.char_buf_ptr++; - tty->flip.count++; - ignore_char: - icom_port->statStg->rcv[rcv_buff].flags = 0; + tty_insert_flip_char(tty, *(icom_port->recv_buf + offset + count - 1), flag); + + if (status & SA_FLAGS_OVERRUN) + /* + * Overrun is special, since it's + * reported immediately, and doesn't + * affect the current character + */ + tty_insert_flip_char(tty, 0, TTY_OVERRUN); +ignore_char: + icom_port->statStg->rcv[rcv_buff].flags = 0; icom_port->statStg->rcv[rcv_buff].leLength = 0; icom_port->statStg->rcv[rcv_buff].WorkingLength = (unsigned short int) cpu_to_le16(RCV_BUFF_SZ); @@ -855,8 +844,7 @@ static void process_interrupt(u16 port_int_reg, spin_unlock(&icom_port->uart_port.lock); } -static irqreturn_t icom_interrupt(int irq, void *dev_id, - struct pt_regs *regs) +static irqreturn_t icom_interrupt(int irq, void *dev_id) { void __iomem * int_reg; u32 adapter_interrupts; @@ -989,18 +977,16 @@ static unsigned int icom_get_mctrl(struct uart_port *port) return result; } -static void icom_stop_tx(struct uart_port *port, unsigned int tty_stop) +static void icom_stop_tx(struct uart_port *port) { unsigned char cmdReg; - if (tty_stop) { - trace(ICOM_PORT, "STOP", 0); - cmdReg = readb(&ICOM_PORT->dram->CmdReg); - writeb(cmdReg | CMD_HOLD_XMIT, &ICOM_PORT->dram->CmdReg); - } + trace(ICOM_PORT, "STOP", 0); + cmdReg = readb(&ICOM_PORT->dram->CmdReg); + writeb(cmdReg | CMD_HOLD_XMIT, &ICOM_PORT->dram->CmdReg); } -static void icom_start_tx(struct uart_port *port, unsigned int tty_start) +static void icom_start_tx(struct uart_port *port) { unsigned char cmdReg; @@ -1101,8 +1087,8 @@ static void icom_close(struct uart_port *port) } static void icom_set_termios(struct uart_port *port, - struct termios *termios, - struct termios *old_termios) + struct ktermios *termios, + struct ktermios *old_termios) { int baud; unsigned cflag, iflag; @@ -1524,7 +1510,7 @@ static int __devinit icom_probe(struct pci_dev *dev, } if ( (retval = pci_request_regions(dev, "icom"))) { - dev_err(&dev->dev, "pci_request_region FAILED\n"); + dev_err(&dev->dev, "pci_request_regions FAILED\n"); pci_disable_device(dev); return retval; } @@ -1576,7 +1562,7 @@ static int __devinit icom_probe(struct pci_dev *dev, /* save off irq and request irq line */ if ( (retval = request_irq(dev->irq, icom_interrupt, - SA_INTERRUPT | SA_SHIRQ, ICOM_DRIVER_NAME, + IRQF_DISABLED | IRQF_SHARED, ICOM_DRIVER_NAME, (void *) icom_adapter))) { goto probe_exit2; }