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] [thread-next>] [day] [month] [year] [list]
Message-ID: <1273143571.3477.29.camel@gentoo-ija64.mev.local>
Date:	Thu, 6 May 2010 11:59:31 +0100
From:	Ian Abbott <abbotti@....co.uk>
To:	"nios2-dev@...c.et.ntust.edu.tw" <nios2-dev@...c.et.ntust.edu.tw>
CC:	"linux-serial@...r.kernel.org" <linux-serial@...r.kernel.org>,
	"gregkh@...e.de" <gregkh@...e.de>,
	"akpm@...ux-foundation.org" <akpm@...ux-foundation.org>,
	"sfr@...b.auug.org.au" <sfr@...b.auug.org.au>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	"alan@...rguk.ukuu.org.uk" <alan@...rguk.ukuu.org.uk>
Subject: Re: [Nios2-dev] [PATCH 1/2] serial: Add driver for the Altera JTAG
 UART

On Wed, 2010-05-05 at 09:35 +0100, Tobias Klauser wrote:
> Add an UART driver for the JTAG UART component available as a SOPC
> (System on Programmable Chip) component for Altera FPGAs.
> 
> Signed-off-by: Tobias Klauser <tklauser@...tanz.ch>
[...]
> +#if defined(CONFIG_SERIAL_ALTERA_JTAGUART_CONSOLE_BYPASS)
> +static void altera_jtaguart_console_putc(struct console *co, const char c)
> +{
> +       struct uart_port *port = &(altera_jtaguart_ports + co->index)->port;
> +       unsigned long status;
> +       unsigned long flags;
> +
> +       spin_lock_irqsave(&port->lock, flags);
> +       while (((status = readl(port->membase + ALTERA_JTAGUART_CONTROL_REG)) &
> +               ALTERA_JTAGUART_CONTROL_WSPACE_MSK) == 0) {
> +               if ((status & ALTERA_JTAGUART_CONTROL_AC_MSK) == 0) {
> +                       spin_unlock_irqrestore(&port->lock, flags);
> +                       return; /* no connection activity */
> +               }
> +               spin_unlock_irqrestore(&port->lock, flags);
> +               cpu_relax();
> +               spin_lock_irqsave(&port->lock, flags);
> +       }
> +       writel(c, port->membase + ALTERA_JTAGUART_DATA_REG);
> +       spin_unlock_irqrestore(&port->lock, flags);
> +}
> +#else
> +static void altera_jtaguart_console_putc(struct console *co, const char c)
> +{
> +       struct uart_port *port = &(altera_jtaguart_ports + co->index)->port;
> +       unsigned long flags;
> +
> +       spin_lock_irqsave(&port->lock, flags);
> +       while ((readl(port->membase + ALTERA_JTAGUART_CONTROL_REG) &
> +               ALTERA_JTAGUART_CONTROL_WSPACE_MSK) == 0) {
> +               spin_unlock_irqrestore(&port->lock, flags);
> +               cpu_relax();
> +               spin_lock_irqsave(&port->lock, flags);
> +       }
> +       writel(c, port->membase + ALTERA_JTAGUART_DATA_REG);
> +       spin_unlock_irqrestore(&port->lock, flags);
> +}
> +#endif

I was originally responsible for adding the spin locks to these console
putc functions, but I'm not sure what the policy is regarding that, as
the 8250 driver doesn't use them for console output for example.

-- 
-=( Ian Abbott @ MEV Ltd.    E-mail: <abbotti@....co.uk>        )=-
-=( Tel: +44 (0)161 477 1898   FAX: +44 (0)161 718 3587         )=-

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ