Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f5316b4a authored by Jason Wessel's avatar Jason Wessel
Browse files

kgdb,8250,pl011: Return immediately from console poll



The design of the kdb shell requires that every device that can
provide input to kdb have a polling routine that exits immediately if
there is no character available.  This is required in order to get the
page scrolling mechanism working.

Changing the kernel debugger I/O API to require all polling character
routines to exit immediately if there is no data allows the kernel
debugger to process multiple input channels.

NO_POLL_CHAR will be the return code to the polling routine when ever
there is no character available.

CC: linux-serial@vger.kernel.org
Signed-off-by: default avatarJason Wessel <jason.wessel@windriver.com>
parent dcc78711
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -1891,8 +1891,8 @@ static int serial8250_get_poll_char(struct uart_port *port)
	struct uart_8250_port *up = (struct uart_8250_port *)port;
	unsigned char lsr = serial_inp(up, UART_LSR);

	while (!(lsr & UART_LSR_DR))
		lsr = serial_inp(up, UART_LSR);
	if (!(lsr & UART_LSR_DR))
		return NO_POLL_CHAR;

	return serial_inp(up, UART_RX);
}
+3 −3
Original line number Diff line number Diff line
@@ -342,9 +342,9 @@ static int pl010_get_poll_char(struct uart_port *port)
	struct uart_amba_port *uap = (struct uart_amba_port *)port;
	unsigned int status;

	do {
	status = readw(uap->port.membase + UART01x_FR);
	} while (status & UART01x_FR_RXFE);
	if (status & UART01x_FR_RXFE)
		return NO_POLL_CHAR;

	return readw(uap->port.membase + UART01x_DR);
}
+1 −0
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@
#include <asm/atomic.h>

#define KDB_POLL_FUNC_MAX	5
extern int kdb_poll_idx;

/*
 * kdb_initial_cpu is initialized to -1, and is set to the cpu
+1 −0
Original line number Diff line number Diff line
@@ -246,6 +246,7 @@ struct uart_ops {
#endif
};

#define NO_POLL_CHAR		0x00ff0000
#define UART_CONFIG_TYPE	(1 << 0)
#define UART_CONFIG_IRQ		(1 << 1)

+2 −0
Original line number Diff line number Diff line
@@ -882,6 +882,8 @@ EXPORT_SYMBOL_GPL(kgdb_unregister_io_module);
int dbg_io_get_char(void)
{
	int ret = dbg_io_ops->read_char();
	if (ret == NO_POLL_CHAR)
		return -1;
	if (!dbg_kdb_mode)
		return ret;
	if (ret == 127)
Loading