poll_get_char method in uart driver
Hi all.
I`m trying to activate kgdb on amlogic board, running kernel version.
It seems that they have implemented poll_get_char method incorrectly,
from documentation of kgdb (example driver 8250.c) it seems that the
method poll_get_char should block until character is available,
here is the code from 8250.c file
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);
return serial_inp(up, UART_RX);
}
while amlogic does not do that.
amlogic implementation:
static int am_uart_get_poll_char(struct uart_port *port)
{
struct am_uart_port * info = &am_ports[port->line];
am_uart_t *uart = uart_addr[info->line];
int status,rx;
mutex_lock(&info->info_mutex);
if ((status = __raw_readl(&uart->status) & 0x7f))
rx = __raw_readl(&uart->rdata);
else
rx = 0;
mutex_unlock(&info->info_mutex);
return rx;
}
I could not find any "contract" of this method in documentation or forums , so it is unclear whether the "poll_get_char" implementation should "poll" indefinitely until there is a character available, or just check whether there is character available, or poll during some amount of time.
This is the question, what is the contract of this method?
Thanks, Regards Sasha.
|