lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Fri, 25 Nov 2022 12:08:32 +0100
From:   Jiri Slaby <jirislaby@...nel.org>
To:     Ilpo Järvinen <ilpo.jarvinen@...ux.intel.com>,
        linux-serial@...r.kernel.org,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH 4/6] serial: 8250: Add IIR FIFOs enabled field properly

On 24. 11. 22, 13:59, Ilpo Järvinen wrote:
> Don't use magic literals & comments but define a real field instead
> for UART_IIR_FIFO_ENABLED and name also the values.
> 
> Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@...ux.intel.com>
> ---
>   drivers/tty/serial/8250/8250_port.c | 17 +++++++----------
>   include/uapi/linux/serial_reg.h     |  4 ++++
>   2 files changed, 11 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/tty/serial/8250/8250_port.c b/drivers/tty/serial/8250/8250_port.c
> index e79bf2afd9be..6d343b15bc58 100644
> --- a/drivers/tty/serial/8250/8250_port.c
> +++ b/drivers/tty/serial/8250/8250_port.c
> @@ -1293,22 +1293,19 @@ static void autoconfig(struct uart_8250_port *up)
>   
>   	serial_out(up, UART_FCR, UART_FCR_ENABLE_FIFO);
>   
> -	/* Assign this as it is to truncate any bits above 7.  */
> -	scratch = serial_in(up, UART_IIR);
> -
> -	switch (scratch >> 6) {
> -	case 0:
> +	switch (serial_in(up, UART_IIR) & UART_IIR_FIFO_ENABLED) {
> +	case UART_IIR_FIFO_ENABLED_8250:
>   		autoconfig_8250(up);
>   		break;
> -	case 1:
> -		port->type = PORT_UNKNOWN;
> -		break;
> -	case 2:
> +	case UART_IIR_FIFO_EAABLED_16550:

EAABLED :)?

> --- a/include/uapi/linux/serial_reg.h
> +++ b/include/uapi/linux/serial_reg.h
> @@ -44,6 +44,10 @@
>   #define UART_IIR_RX_TIMEOUT	0x0c /* OMAP RX Timeout interrupt */
>   #define UART_IIR_XOFF		0x10 /* OMAP XOFF/Special Character */
>   #define UART_IIR_CTS_RTS_DSR	0x20 /* OMAP CTS/RTS/DSR Change */
> +#define UART_IIR_FIFO_ENABLED	0xc0 /* FIFOs enabled / port type identification */
> +#define  UART_IIR_FIFO_ENABLED_8250	0x00	/* 8250: no FIFO */
> +#define  UART_IIR_FIFO_EAABLED_16550	0x80	/* 16550: (broken/unusable) FIFO */
> +#define  UART_IIR_FIFO_ENABLED_16550A	0xc0	/* 16550A: FIFO enabled */
>   
>   #define UART_FCR	2	/* Out: FIFO Control Register */
>   #define UART_FCR_ENABLE_FIFO	0x01 /* Enable the FIFO */

-- 
js
suse labs

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ