.. | .. |
---|
675 | 675 | return -ENODEV; |
---|
676 | 676 | } |
---|
677 | 677 | |
---|
| 678 | +#ifdef CONFIG_RAW_PRINTK |
---|
| 679 | + |
---|
| 680 | +static void raw_write_char(struct uart_8250_port *up, int c) |
---|
| 681 | +{ |
---|
| 682 | + unsigned int status, tmout = 10000; |
---|
| 683 | + |
---|
| 684 | + for (;;) { |
---|
| 685 | + status = serial_in(up, UART_LSR); |
---|
| 686 | + up->lsr_saved_flags |= status & LSR_SAVE_FLAGS; |
---|
| 687 | + if ((status & UART_LSR_THRE) == UART_LSR_THRE) |
---|
| 688 | + break; |
---|
| 689 | + if (--tmout == 0) |
---|
| 690 | + break; |
---|
| 691 | + cpu_relax(); |
---|
| 692 | + } |
---|
| 693 | + serial_port_out(&up->port, UART_TX, c); |
---|
| 694 | +} |
---|
| 695 | + |
---|
| 696 | +static void univ8250_console_write_raw(struct console *co, const char *s, |
---|
| 697 | + unsigned int count) |
---|
| 698 | +{ |
---|
| 699 | + struct uart_8250_port *up = &serial8250_ports[co->index]; |
---|
| 700 | + unsigned int ier; |
---|
| 701 | + |
---|
| 702 | + ier = serial_in(up, UART_IER); |
---|
| 703 | + |
---|
| 704 | + if (up->capabilities & UART_CAP_UUE) |
---|
| 705 | + serial_out(up, UART_IER, UART_IER_UUE); |
---|
| 706 | + else |
---|
| 707 | + serial_out(up, UART_IER, 0); |
---|
| 708 | + |
---|
| 709 | + while (count-- > 0) { |
---|
| 710 | + if (*s == '\n') |
---|
| 711 | + raw_write_char(up, '\r'); |
---|
| 712 | + raw_write_char(up, *s++); |
---|
| 713 | + } |
---|
| 714 | + |
---|
| 715 | + serial_out(up, UART_IER, ier); |
---|
| 716 | +} |
---|
| 717 | + |
---|
| 718 | +#endif |
---|
| 719 | + |
---|
678 | 720 | static struct console univ8250_console = { |
---|
679 | 721 | .name = "ttyS", |
---|
680 | 722 | .write = univ8250_console_write, |
---|
.. | .. |
---|
682 | 724 | .setup = univ8250_console_setup, |
---|
683 | 725 | .exit = univ8250_console_exit, |
---|
684 | 726 | .match = univ8250_console_match, |
---|
| 727 | +#ifdef CONFIG_RAW_PRINTK |
---|
| 728 | + .write_raw = univ8250_console_write_raw, |
---|
| 729 | +#endif |
---|
685 | 730 | .flags = CON_PRINTBUFFER | CON_ANYTIME, |
---|
686 | 731 | .index = -1, |
---|
687 | 732 | .data = &serial8250_reg, |
---|