Date: Sun, 22 Dec 2013 09:55:53 -0700 From: Warner Losh <imp@bsdimp.com> To: Ganbold Tsagaankhuu <ganbold@gmail.com> Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Warner Losh <imp@freebsd.org> Subject: Re: svn commit: r259685 - in head/sys: arm/at91 dev/uart Message-ID: <DB77CF81-A814-49DC-95F4-966413B49C49@bsdimp.com> In-Reply-To: <CAGtf9xNnzgi1bsfFdYZBoeZuUT267NaFx=rEYaHjc60YuzUdmQ@mail.gmail.com> References: <201312211623.rBLGNVaq008807@svn.freebsd.org> <CAGtf9xNnzgi1bsfFdYZBoeZuUT267NaFx=rEYaHjc60YuzUdmQ@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Dec 22, 2013, at 2:28 AM, Ganbold Tsagaankhuu wrote: >=20 >=20 >=20 > On Sun, Dec 22, 2013 at 12:23 AM, Warner Losh <imp@freebsd.org> wrote: > Author: imp > Date: Sat Dec 21 16:23:31 2013 > New Revision: 259685 > URL: http://svnweb.freebsd.org/changeset/base/259685 >=20 > Log: > 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. >=20 > MFC after: 3 days >=20 > Modified: > head/sys/arm/at91/uart_dev_at91usart.c > head/sys/dev/uart/uart_cpu.h > head/sys/dev/uart/uart_tty.c >=20 >=20 > There is PR "kern/184919: uart infrastructure missing console grab / = ungrab hooks", maybe that one should be closed. Yup. This looks to be filed 5 days ago. I had no clue it was even there = and came up with mine independently... Warner >=20 > Ganbold >=20 >=20 > =20 >=20 > Modified: head/sys/arm/at91/uart_dev_at91usart.c > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > --- head/sys/arm/at91/uart_dev_at91usart.c Sat Dec 21 15:40:36 = 2013 (r259684) > +++ head/sys/arm/at91/uart_dev_at91usart.c Sat Dec 21 16:23:31 = 2013 (r259685) > @@ -219,6 +219,20 @@ at91_usart_param(struct uart_bas *bas, i > return (0); > } >=20 > +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 =3D { > .probe =3D at91_usart_probe, > .init =3D at91_usart_init, > @@ -226,6 +240,8 @@ static struct uart_ops at91_usart_ops =3D > .putc =3D at91_usart_putc, > .rxready =3D at91_usart_rxready, > .getc =3D at91_usart_getc, > + .grab =3D at91_usart_grab, > + .ungrab =3D at91_usart_ungrab, > }; >=20 > static int >=20 > Modified: head/sys/dev/uart/uart_cpu.h > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > --- head/sys/dev/uart/uart_cpu.h Sat Dec 21 15:40:36 2013 = (r259684) > +++ head/sys/dev/uart/uart_cpu.h Sat Dec 21 16:23:31 2013 = (r259685) > @@ -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 *); > }; >=20 > 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); > } >=20 > +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) > { >=20 > Modified: head/sys/dev/uart/uart_tty.c > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > --- head/sys/dev/uart/uart_tty.c Sat Dec 21 15:40:36 2013 = (r259684) > +++ head/sys/dev/uart/uart_tty.c Sat Dec 21 16:23:31 2013 = (r259685) > @@ -112,11 +112,15 @@ uart_cnterm(struct consdev *cp) > static void > uart_cngrab(struct consdev *cp) > { > + > + uart_grab(cp->cn_arg); > } >=20 > static void > uart_cnungrab(struct consdev *cp) > { > + > + uart_ungrab(cp->cn_arg); > } >=20 > static void >=20
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?DB77CF81-A814-49DC-95F4-966413B49C49>