Date: Mon, 23 Dec 2013 01:24:32 +0000 (UTC) From: Warner Losh <imp@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r259759 - in stable/10/sys: arm/at91 dev/uart Message-ID: <201312230124.rBN1OWUE023379@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: imp Date: Mon Dec 23 01:24:32 2013 New Revision: 259759 URL: http://svnweb.freebsd.org/changeset/base/259759 Log: MFC r259685: Plumb the cn_grab and cn_ungrab routines down into the uart clients. Mask RX interrupts while grabbed on the atmel serial driver. This UART interrupts every character. When interrupts are enabled at the mountroot> prompt, this means the ISR eats the characters. Rather than try to create a cooperative buffering system for the low level kernel console, instead just mask out the ISR. For NS8250 and decsendents this isn't needed, since interrupts only happen after 14 or more characters (depending on the fifo settings). Plumb such that these are optional so there's no change in behavior for all the other UART clients. ddb worked on this platform because all interrupts were disabled while it was running, so this problem wasn't noticed. The mountroot> issue has been around for a very very long time. Approved by: re@ (gjb@) Modified: stable/10/sys/arm/at91/uart_dev_at91usart.c stable/10/sys/dev/uart/uart_cpu.h stable/10/sys/dev/uart/uart_tty.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/arm/at91/uart_dev_at91usart.c ============================================================================== --- stable/10/sys/arm/at91/uart_dev_at91usart.c Mon Dec 23 01:24:21 2013 (r259758) +++ stable/10/sys/arm/at91/uart_dev_at91usart.c Mon Dec 23 01:24:32 2013 (r259759) @@ -219,6 +219,20 @@ at91_usart_param(struct uart_bas *bas, i return (0); } +static void +at91_usart_grab(struct uart_bas *bas) +{ + + WR4(bas, USART_IDR, USART_CSR_RXRDY); +} + +static void +at91_usart_ungrab(struct uart_bas *bas) +{ + + WR4(bas, USART_IER, USART_CSR_RXRDY); +} + static struct uart_ops at91_usart_ops = { .probe = at91_usart_probe, .init = at91_usart_init, @@ -226,6 +240,8 @@ static struct uart_ops at91_usart_ops = .putc = at91_usart_putc, .rxready = at91_usart_rxready, .getc = at91_usart_getc, + .grab = at91_usart_grab, + .ungrab = at91_usart_ungrab, }; static int Modified: stable/10/sys/dev/uart/uart_cpu.h ============================================================================== --- stable/10/sys/dev/uart/uart_cpu.h Mon Dec 23 01:24:21 2013 (r259758) +++ stable/10/sys/dev/uart/uart_cpu.h Mon Dec 23 01:24:32 2013 (r259759) @@ -43,6 +43,8 @@ struct uart_ops { void (*putc)(struct uart_bas *, int); int (*rxready)(struct uart_bas *); int (*getc)(struct uart_bas *, struct mtx *); + void (*grab)(struct uart_bas *); + void (*ungrab)(struct uart_bas *); }; extern bus_space_tag_t uart_bus_space_io; @@ -135,6 +137,27 @@ uart_putc(struct uart_devinfo *di, int c uart_unlock(di->hwmtx); } +static __inline void +uart_grab(struct uart_devinfo *di) +{ + + uart_lock(di->hwmtx); + if (di->ops->grab) + di->ops->grab(&di->bas); + uart_unlock(di->hwmtx); +} + +static __inline void +uart_ungrab(struct uart_devinfo *di) +{ + + uart_lock(di->hwmtx); + if (di->ops->ungrab) + di->ops->ungrab(&di->bas); + uart_unlock(di->hwmtx); +} + + static __inline int uart_rxready(struct uart_devinfo *di) { Modified: stable/10/sys/dev/uart/uart_tty.c ============================================================================== --- stable/10/sys/dev/uart/uart_tty.c Mon Dec 23 01:24:21 2013 (r259758) +++ stable/10/sys/dev/uart/uart_tty.c Mon Dec 23 01:24:32 2013 (r259759) @@ -112,11 +112,15 @@ uart_cnterm(struct consdev *cp) static void uart_cngrab(struct consdev *cp) { + + uart_grab(cp->cn_arg); } static void uart_cnungrab(struct consdev *cp) { + + uart_ungrab(cp->cn_arg); } static void
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201312230124.rBN1OWUE023379>