Add the CONSOLE_POLL hooks for use with kgdboc on the sunhv uart
driver.

Signed-off-by: Jason Wessel <[email protected]>
CC: David S. Miller <[email protected]>
CC: [email protected]
---
 drivers/serial/sunhv.c |   51 ++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 51 insertions(+), 0 deletions(-)

diff --git a/drivers/serial/sunhv.c b/drivers/serial/sunhv.c
index 890f917..bab9515 100644
--- a/drivers/serial/sunhv.c
+++ b/drivers/serial/sunhv.c
@@ -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 = {
-- 
1.6.4.rc1


------------------------------------------------------------------------------
The Palm PDK Hot Apps Program offers developers who use the
Plug-In Development Kit to bring their C/C++ apps to Palm for a share
of $1 Million in cash or HP Products. Visit us here for more details:
http://p.sf.net/sfu/dev2dev-palm
_______________________________________________
Kgdb-bugreport mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/kgdb-bugreport

Reply via email to