static int omahauart_console_wait_key(struct console *co) { struct uart_port *port = omaha_ports + co->index; unsigned int status; do { status = UART_FIFO_STATUS(port); } while (!UART_RX_DATA(status)); return UART_GET_CHAR(port); }
static void pl010_rx_chars(struct uart_amba_port *uap) { struct tty_struct *tty = uap->port.state->port.tty; unsigned int status, ch, flag, rsr, max_count = 256; status = readb(uap->port.membase + UART01x_FR); while (UART_RX_DATA(status) && max_count--) { ch = readb(uap->port.membase + UART01x_DR); flag = TTY_NORMAL; uap->port.icount.rx++; /* * Note that the error handling code is * out of the main execution path */ rsr = readb(uap->port.membase + UART01x_RSR) | UART_DUMMY_RSR_RX; if (unlikely(rsr & UART01x_RSR_ANY)) { writel(0, uap->port.membase + UART01x_ECR); if (rsr & UART01x_RSR_BE) { rsr &= ~(UART01x_RSR_FE | UART01x_RSR_PE); uap->port.icount.brk++; if (uart_handle_break(&uap->port)) goto ignore_char; } else if (rsr & UART01x_RSR_PE) uap->port.icount.parity++; else if (rsr & UART01x_RSR_FE) uap->port.icount.frame++; if (rsr & UART01x_RSR_OE) uap->port.icount.overrun++; rsr &= uap->port.read_status_mask; if (rsr & UART01x_RSR_BE) flag = TTY_BREAK; else if (rsr & UART01x_RSR_PE) flag = TTY_PARITY; else if (rsr & UART01x_RSR_FE) flag = TTY_FRAME; } if (uart_handle_sysrq_char(&uap->port, ch)) goto ignore_char; uart_insert_char(&uap->port, rsr, UART01x_RSR_OE, ch, flag); ignore_char: status = readb(uap->port.membase + UART01x_FR); } spin_unlock(&uap->port.lock); tty_flip_buffer_push(tty); spin_lock(&uap->port.lock); }
static void omahauart_int_rx(int irq, void *dev_id, struct pt_regs *regs) { struct uart_info *info = dev_id; volatile unsigned int status, pass_counter = OMAHA_ISR_PASS_LIMIT; status = UART_FIFO_STATUS(info->port); do { if (UART_RX_DATA(status)) #ifdef SUPPORT_SYSRQ omahauart_rx_chars(info, regs); #else omahauart_rx_chars(info); #endif if (pass_counter-- == 0) break; status = UART_FIFO_STATUS(info->port); } while (UART_RX_DATA(status)); }
static void apbuart_rx_chars(struct uart_port *port) { unsigned int status, ch, rsr, flag; unsigned int max_chars = port->fifosize; status = UART_GET_STATUS(port); while (UART_RX_DATA(status) && (max_chars--)) { ch = UART_GET_CHAR(port); flag = TTY_NORMAL; port->icount.rx++; rsr = UART_GET_STATUS(port) | UART_DUMMY_RSR_RX; UART_PUT_STATUS(port, 0); if (rsr & UART_STATUS_ERR) { if (rsr & UART_STATUS_BR) { rsr &= ~(UART_STATUS_FE | UART_STATUS_PE); port->icount.brk++; if (uart_handle_break(port)) goto ignore_char; } else if (rsr & UART_STATUS_PE) { port->icount.parity++; } else if (rsr & UART_STATUS_FE) { port->icount.frame++; } if (rsr & UART_STATUS_OE) port->icount.overrun++; rsr &= port->read_status_mask; if (rsr & UART_STATUS_PE) flag = TTY_PARITY; else if (rsr & UART_STATUS_FE) flag = TTY_FRAME; } if (uart_handle_sysrq_char(port, ch)) goto ignore_char; uart_insert_char(port, rsr, UART_STATUS_OE, ch, flag); ignore_char: status = UART_GET_STATUS(port); } spin_unlock(&port->lock); tty_flip_buffer_push(&port->state->port); spin_lock(&port->lock); }
pl010_rx_chars(struct uart_port *port) #endif { struct tty_struct *tty = port->info->tty; unsigned int status, ch, flag, rsr, max_count = 256; status = UART_GET_FR(port); while (UART_RX_DATA(status) && max_count--) { ch = UART_GET_CHAR(port); flag = TTY_NORMAL; port->icount.rx++; /* * Note that the error handling code is * out of the main execution path */ rsr = UART_GET_RSR(port) | UART_DUMMY_RSR_RX; if (unlikely(rsr & UART01x_RSR_ANY)) { if (rsr & UART01x_RSR_BE) { rsr &= ~(UART01x_RSR_FE | UART01x_RSR_PE); port->icount.brk++; if (uart_handle_break(port)) goto ignore_char; } else if (rsr & UART01x_RSR_PE) port->icount.parity++; else if (rsr & UART01x_RSR_FE) port->icount.frame++; if (rsr & UART01x_RSR_OE) port->icount.overrun++; rsr &= port->read_status_mask; if (rsr & UART01x_RSR_BE) flag = TTY_BREAK; else if (rsr & UART01x_RSR_PE) flag = TTY_PARITY; else if (rsr & UART01x_RSR_FE) flag = TTY_FRAME; } if (uart_handle_sysrq_char(port, ch, regs)) goto ignore_char; uart_insert_char(port, rsr, UART01x_RSR_OE, ch, flag); ignore_char: status = UART_GET_FR(port); } tty_flip_buffer_push(tty); return; }
static void uart00_rx_chars(struct uart_port *port, struct pt_regs *regs) { struct tty_struct *tty = port->info->tty; unsigned int status, ch, rds, flg, ignored = 0; status = UART_GET_RSR(port); while (UART_RX_DATA(status)) { /* * We need to read rds before reading the * character from the fifo */ rds = UART_GET_RDS(port); ch = UART_GET_CHAR(port); port->icount.rx++; if (tty->flip.count >= TTY_FLIPBUF_SIZE) goto ignore_char; flg = TTY_NORMAL; /* * Note that the error handling code is * out of the main execution path */ if (rds & (UART_RDS_BI_MSK |UART_RDS_FE_MSK| UART_RDS_PE_MSK |UART_RDS_PE_MSK)) goto handle_error; if (uart_handle_sysrq_char(port, ch, regs)) goto ignore_char; error_return: tty_insert_flip_char(tty, ch, flg); ignore_char: status = UART_GET_RSR(port); } out: tty_flip_buffer_push(tty); return; handle_error: if (rds & UART_RDS_BI_MSK) { status &= ~(UART_RDS_FE_MSK | UART_RDS_PE_MSK); port->icount.brk++; if (uart_handle_break(port)) goto ignore_char; } else if (rds & UART_RDS_PE_MSK) port->icount.parity++; else if (rds & UART_RDS_FE_MSK) port->icount.frame++; if (rds & UART_RDS_OE_MSK) port->icount.overrun++; if (rds & port->ignore_status_mask) { if (++ignored > 100) goto out; goto ignore_char; } rds &= port->read_status_mask; if (rds & UART_RDS_BI_MSK) flg = TTY_BREAK; else if (rds & UART_RDS_PE_MSK) flg = TTY_PARITY; else if (rds & UART_RDS_FE_MSK) flg = TTY_FRAME; if (rds & UART_RDS_OE_MSK) { /* * CHECK: does overrun affect the current character? * ASSUMPTION: it does not. */ tty_insert_flip_char(tty, ch, flg); ch = 0; flg = TTY_OVERRUN; } #ifdef SUPPORT_SYSRQ port->sysrq = 0; #endif goto error_return; }
ambauart_rx_chars(struct uart_port *port, unsigned short status) #endif { struct tty_struct *tty = port->info->tty; unsigned short ch, lsr, max_count = 256; while (UART_RX_DATA(status) && max_count--) { lsr = status; if (tty->flip.count >= TTY_FLIPBUF_SIZE) { tty->flip.tqueue.routine((void *)tty); if (tty->flip.count >= TTY_FLIPBUF_SIZE) { printk(KERN_WARNING "TTY_DONT_FLIP set\n"); return; } } ch = UART_GET_CHAR(port); *tty->flip.char_buf_ptr = ch; *tty->flip.flag_buf_ptr = TTY_NORMAL; port->icount.rx++; /* * Note that the error handling code is * out of the main execution path */ lsr |= UART_DUMMY_LSR_RX; if (lsr & KS8695_UART_LINES_ANY) { if (lsr & KS8695_UART_LINES_BE) { lsr &= ~(KS8695_UART_LINES_FE | KS8695_UART_LINES_PE); port->icount.brk++; if (uart_handle_break(port)) goto ignore_char; } else if (lsr & KS8695_UART_LINES_PE) port->icount.parity++; else if (lsr & KS8695_UART_LINES_FE) port->icount.frame++; if (lsr & KS8695_UART_LINES_OE) port->icount.overrun++; lsr &= port->read_status_mask; if (lsr & KS8695_UART_LINES_BE) *tty->flip.flag_buf_ptr = TTY_BREAK; else if (lsr & KS8695_UART_LINES_PE) *tty->flip.flag_buf_ptr = TTY_PARITY; else if (lsr & KS8695_UART_LINES_FE) *tty->flip.flag_buf_ptr = TTY_FRAME; } if (uart_handle_sysrq_char(port, ch, regs)) goto ignore_char; if ((lsr & port->ignore_status_mask) == 0) { tty->flip.flag_buf_ptr++; tty->flip.char_buf_ptr++; tty->flip.count++; } if ((lsr & KS8695_UART_LINES_OE) && tty->flip.count < TTY_FLIPBUF_SIZE) { /* * Overrun is special, since it's reported * immediately, and doesn't affect the current * character */ *tty->flip.char_buf_ptr++ = 0; *tty->flip.flag_buf_ptr++ = TTY_OVERRUN; tty->flip.count++; } ignore_char: status = UART_GET_LSR(port); } tty_flip_buffer_push(tty); return; }
omahauart_rx_chars(struct uart_info *info) #endif { struct tty_struct *tty = info->tty; volatile unsigned int status, data, ch, rsr, max_count = 256; struct uart_port *port = info->port; status = UART_FIFO_STATUS(port); while (UART_RX_DATA(status) && max_count--) { if (tty->flip.count >= TTY_FLIPBUF_SIZE) { tty->flip.tqueue.routine((void *)tty); if (tty->flip.count >= TTY_FLIPBUF_SIZE) { printk(KERN_WARNING "TTY_DONT_FLIP set\n"); return; } } ch = UART_GET_CHAR(port); *tty->flip.char_buf_ptr = ch; *tty->flip.flag_buf_ptr = TTY_NORMAL; port->icount.rx++; /* * Note that the error handling code is * out of the main execution path */ rsr = UART_GET_RSR(port) | UART_DUMMY_RSR_RX; if (rsr & 0xf) { if (rsr & OMAHA_UART_BREAK) { rsr &= ~(OMAHA_UART_FRAME | OMAHA_UART_PARITY); port->icount.brk++; if (uart_handle_break(info, &omaha_console)) goto ignore_char; } else if (rsr & OMAHA_UART_PARITY) port->icount.parity++; else if (rsr & OMAHA_UART_FRAME) port->icount.frame++; if (rsr & OMAHA_UART_OVERRUN) port->icount.overrun++; rsr &= port->read_status_mask; if (rsr & OMAHA_UART_BREAK) *tty->flip.flag_buf_ptr = TTY_BREAK; else if (rsr & OMAHA_UART_PARITY) *tty->flip.flag_buf_ptr = TTY_PARITY; else if (rsr & OMAHA_UART_FRAME) *tty->flip.flag_buf_ptr = TTY_FRAME; } if (uart_handle_sysrq_char(info, ch, regs)) goto ignore_char; if ((rsr & port->ignore_status_mask) == 0) { tty->flip.flag_buf_ptr++; tty->flip.char_buf_ptr++; tty->flip.count++; } if ((rsr & OMAHA_UART_OVERRUN) && tty->flip.count < TTY_FLIPBUF_SIZE) { /* * Overrun is special, since it's reported * immediately, and doesn't affect the current * character */ *tty->flip.char_buf_ptr++ = 0; *tty->flip.flag_buf_ptr++ = TTY_OVERRUN; tty->flip.count++; } ignore_char: status = UART_FIFO_STATUS(port); } tty_flip_buffer_push(tty); return; }
leonuart_rx_chars(struct uart_port *port) #endif { struct tty_struct *tty = port->info->port.tty; unsigned int status, ch, rsr, flag; unsigned int max_chars = port->fifosize; status = UART_GET_STATUS(port); while (UART_RX_DATA(status) && (max_chars--)) { /* if (tty->flip.count >= TTY_FLIPBUF_SIZE) { tty->flip.work.func((void *)tty); if (tty->flip.count >= TTY_FLIPBUF_SIZE) { printk(KERN_WARNING "TTY_DONT_FLIP set\n"); return; } } */ ch = UART_GET_CHAR(port); flag = TTY_NORMAL; /**tty->flip.char_buf_ptr = ch; *tty->flip.flag_buf_ptr = TTY_NORMAL;*/ port->icount.rx++; /* * Note that the error handling code is * out of the main execution path */ rsr = UART_GET_STATUS(port) | UART_DUMMY_RSR_RX; UART_PUT_STATUS(port, 0); if (rsr & LEON_REG_UART_STATUS_ERR) { if (rsr & LEON_REG_UART_STATUS_BR) { rsr &= ~(LEON_REG_UART_STATUS_FE | LEON_REG_UART_STATUS_PE); port->icount.brk++; if (uart_handle_break(port)) goto ignore_char; } else if (rsr & LEON_REG_UART_STATUS_PE) { port->icount.parity++; } else if (rsr & LEON_REG_UART_STATUS_FE) { port->icount.frame++; } if (rsr & LEON_REG_UART_STATUS_OE) port->icount.overrun++; rsr &= port->read_status_mask; /* if (rsr & LEON_REG_UART_STATUS_PE) *tty->flip.flag_buf_ptr = TTY_PARITY; else if (rsr & LEON_REG_UART_STATUS_FE) *tty->flip.flag_buf_ptr = TTY_FRAME; */ if (rsr & LEON_REG_UART_STATUS_PE) flag = TTY_PARITY; else if (rsr & LEON_REG_UART_STATUS_FE) flag = TTY_FRAME; } if (uart_handle_sysrq_char(port, ch)) goto ignore_char; /* if ((rsr & port->ignore_status_mask) == 0) { tty->flip.flag_buf_ptr++; tty->flip.char_buf_ptr++; tty->flip.count++; } */ if ((rsr & port->ignore_status_mask) == 0) { tty_insert_flip_char(tty, ch, flag); } if ( rsr & LEON_REG_UART_STATUS_OE ) { /* * 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: status = UART_GET_STATUS(port); } tty_flip_buffer_push(tty); return; }
leonuart_rx_chars(struct uart_port *port) #endif { struct tty_struct *tty = port->info->tty; unsigned int status, ch, flag, rsr, max_count = 256; status = UART_GET_STATUS(port); while (UART_RX_DATA(status) && max_count--) { //if (tty->flip.count >= TTY_FLIPBUF_SIZE) { // if (tty->low_latency) // tty_flip_buffer_push(tty); /* * If this failed then we will throw away the * bytes but must do so to clear interrupts. */ //} ch = UART_GET_CHAR(port); flag = TTY_NORMAL; port->icount.rx++; /* * Note that the error handling code is * out of the main execution path */ rsr = UART_GET_STATUS(port) | UART_DUMMY_RSR_RX; UART_PUT_STATUS(port, 0); if (rsr & LEON_USTAT_ERROR) { if (rsr & LEON_USTAT_BR) { rsr &= ~(LEON_USTAT_FE | LEON_USTAT_PE); port->icount.brk++; if (uart_handle_break(port)) goto ignore_char; } else if (rsr & LEON_USTAT_PE) { port->icount.parity++; } else if (rsr & LEON_USTAT_FE) { port->icount.frame++; } if (rsr & LEON_USTAT_OV) port->icount.overrun++; rsr &= port->read_status_mask; if (rsr & LEON_USTAT_BR) flag = TTY_BREAK; else if (rsr & LEON_USTAT_PE) flag = TTY_PARITY; else if (rsr & LEON_USTAT_FE) flag = TTY_FRAME; } if (uart_handle_sysrq_char(port, ch)) goto ignore_char; if ((rsr & port->ignore_status_mask) == 0) { tty_insert_flip_char(tty, ch, flag); } if (rsr & LEON_USTAT_OV) { /* * 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: status = UART_GET_STATUS(port); } tty_flip_buffer_push(tty); return; }