@@ -309,6 +309,53 @@ static void sunhv_break_ctl(struct uart_port *port, int break_state)
}
}
+#ifdef CONFIG_CONSOLE_POLL
+/*
+ * Console polling routines for writing and reading from the uart while
+ * in an interrupt or debug context.
+ */
+
+static int poll_buf[PAGE_SIZE];
+static int poll_buf_cnt;
+static int poll_buf_idx;
+
+static int sunhv_get_poll_char(struct uart_port *port)
+{
+ unsigned long bytes_read;
+ long stat;
+ unsigned long ra;
+ int i;
+
+ if (poll_buf_idx < poll_buf_cnt)
+ return poll_buf[poll_buf_idx++];
+
+ ra = __pa(con_read_page);
+ stat = sun4v_con_read(ra, PAGE_SIZE, &bytes_read);
+ if (stat == HV_EOK) {
+ poll_buf_idx = 1;
+ poll_buf_cnt = bytes_read;
+ for (i = 0; i < bytes_read; i++)
+ poll_buf[i] = con_read_page[i];
+ return poll_buf[0];
+ }
+
+ return NO_POLL_CHAR;
+}
+
+
+static void sunhv_put_poll_char(struct uart_port *port,
+ unsigned char c)
+{
+ while (1) {
+ long status = sun4v_con_putchar(c);
+ if (status == HV_EOK)
+ break;
+ udelay(1);
+ }
+}
+
+#endif /* CONFIG_CONSOLE_POLL */
+
/* port->lock is not held. */
static int sunhv_startup(struct uart_port *port)
{
@@ -388,6 +435,10 @@ static struct uart_ops sunhv_pops = {
.request_port = sunhv_request_port,
.config_port = sunhv_config_port,
.verify_port = sunhv_verify_port,
+#ifdef CONFIG_CONSOLE_POLL
+ .poll_get_char = sunhv_get_poll_char,
+ .poll_put_char = sunhv_put_poll_char,
+#endif
};
static struct uart_driver sunhv_reg = {
Add the CONSOLE_POLL hooks for use with kgdboc on the sunhv uart driver. Signed-off-by: Jason Wessel <jason.wessel@windriver.com> CC: David S. Miller <davem@davemloft.net> CC: sparclinux@vger.kernel.org --- drivers/serial/sunhv.c | 51 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 51 insertions(+), 0 deletions(-)