The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=56139f727f6d0d0a6d2f120b67f8c1d70e8c18d4
commit 56139f727f6d0d0a6d2f120b67f8c1d70e8c18d4 Author: Warner Losh <i...@freebsd.org> AuthorDate: 2024-10-14 21:57:54 +0000 Commit: Warner Losh <i...@freebsd.org> CommitDate: 2024-10-14 22:03:58 +0000 uart/ns8250: Disable interrupts sooner Disable interrupts before we set the parameters for the UART. Usually, it makes no difference, but it's possible that setting the baud rate, etc could create problems if there's data pending, so move the interrupt disabling ealier. Sponsored by: Netflix Reviewed by: andrew Differential Revision: https://reviews.freebsd.org/D47075 --- sys/dev/uart/uart_dev_ns8250.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sys/dev/uart/uart_dev_ns8250.c b/sys/dev/uart/uart_dev_ns8250.c index d43a48f319e4..f59f5fa80e9c 100644 --- a/sys/dev/uart/uart_dev_ns8250.c +++ b/sys/dev/uart/uart_dev_ns8250.c @@ -359,10 +359,6 @@ ns8250_init(struct uart_bas *bas, int baudrate, int databits, int stopbits, { u_char ier; - if (bas->rclk == 0) - bas->rclk = DEFAULT_RCLK; - ns8250_param(bas, baudrate, databits, stopbits, parity); - /* Disable all interrupt sources. */ /* * We use 0xe0 instead of 0xf0 as the mask because the XScale PXA @@ -373,6 +369,10 @@ ns8250_init(struct uart_bas *bas, int baudrate, int databits, int stopbits, uart_setreg(bas, REG_IER, ier); uart_barrier(bas); + if (bas->rclk == 0) + bas->rclk = DEFAULT_RCLK; + ns8250_param(bas, baudrate, databits, stopbits, parity); + /* Disable the FIFO (if present). */ uart_setreg(bas, REG_FCR, 0); uart_barrier(bas);