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: <20090219131758.088381f3.akpm@linux-foundation.org>
Date:	Thu, 19 Feb 2009 13:17:58 -0800
From:	Andrew Morton <akpm@...ux-foundation.org>
To:	Atsushi Nemoto <anemo@....ocn.ne.jp>
Cc:	linux-kernel@...r.kernel.org, ralf@...ux-mips.org,
	jason.wessel@...driver.com
Subject: Re: [PATCH resend] kgdb: kgdboc console poll hooks for serial_txx9
 uart

On Wed, 18 Feb 2009 22:36:41 +0900 (JST)
Atsushi Nemoto <anemo@....ocn.ne.jp> wrote:

> Implement the serial polling hooks for the serial_txx9 uart for use
> with kgdboc.
> 
> ...
>
> diff --git a/drivers/serial/serial_txx9.c b/drivers/serial/serial_txx9.c
> index 8fcb4c5..6f18215 100644
> --- a/drivers/serial/serial_txx9.c
> +++ b/drivers/serial/serial_txx9.c
> @@ -461,6 +461,94 @@ static void serial_txx9_break_ctl(struct uart_port *port, int break_state)
>  	spin_unlock_irqrestore(&up->port.lock, flags);
>  }
>  
> +#if defined(CONFIG_SERIAL_TXX9_CONSOLE) || (CONFIG_CONSOLE_POLL)
> +/*
> + *	Wait for transmitter & holding register to empty
> + */
> +static void wait_for_xmitr(struct uart_txx9_port *up)
> +{
> +	unsigned int tmout = 10000;
> +
> +	/* Wait up to 10ms for the character(s) to be sent. */
> +	while (--tmout &&
> +	       !(sio_in(up, TXX9_SICISR) & TXX9_SICISR_TXALS))
> +		udelay(1);
> +
> +	/* Wait up to 1s for flow control if necessary */
> +	if (up->port.flags & UPF_CONS_FLOW) {
> +		tmout = 1000000;
> +		while (--tmout &&
> +		       (sio_in(up, TXX9_SICISR) & TXX9_SICISR_CTSS))
> +			udelay(1);
> +	}
> +}
> +#endif
> +
> +#ifdef CONFIG_CONSOLE_POLL
> +/*
> + * Console polling routines for writing and reading from the uart while
> + * in an interrupt or debug context.
> + */
> +
> +static int serial_txx9_get_poll_char(struct uart_port *port)
> +{
> +	unsigned int ier;
> +	unsigned char c;
> +	struct uart_txx9_port *up = (struct uart_txx9_port *)port;

It's nicer to use container_of() for this operation.

> ...
>
> +static void serial_txx9_put_poll_char(struct uart_port *port, unsigned char c)
> +{
> +	unsigned int ier;
> +	struct uart_txx9_port *up = (struct uart_txx9_port *)port;

ditto.

> +	/*
> +	 *	First save the IER then disable the interrupts
> +	 */
> +	ier = sio_in(up, TXX9_SIDICR);
> +	sio_out(up, TXX9_SIDICR, 0);
> +
> +	wait_for_xmitr(up);
> +	/*
> +	 *	Send the character out.
> +	 *	If a LF, also do CR...
> +	 */
> +	sio_out(up, TXX9_SITFIFO, c);
> +	if (c == 10) {
> +		wait_for_xmitr(up);
> +		sio_out(up, TXX9_SITFIFO, 13);
> +	}
> +
> +	/*
> +	 *	Finally, wait for transmitter to become empty
> +	 *	and restore the IER
> +	 */
> +	wait_for_xmitr(up);
> +	sio_out(up, TXX9_SIDICR, ier);
> +}
> +

--
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