Update KGDB serial driver for Broadcom SB1250:

- restore the lost ending brace in arch_init_irq();

- fix the interrupt handler to take no arguments, due to 2.6.19-rc1 change,
  remove from it unreacheabe code, and add the missing external declaration;

- fix the write_char() method to accept argument of type 'u8';

- convert the status polling loop in the read_char() method to 'do {} while';

- change 'kgdb_swarm' prefix in the function names to 'kgdbsibyte', so that they
  all look alike;

- kill unneeded {pre|post}_exception() method initializers;

- fix whitespace here and there...

Signed-off-by: Sergei Shtylyov <[EMAIL PROTECTED]>

---
Argh, have almost forgotten to update this one, and it was gravely broken. :-/
The patch is against the linux_2_6_21_uprev branch, as usual...

 arch/mips/sibyte/sb1250/irq.c         |    2 +
 arch/mips/sibyte/sb1250/kgdb_sibyte.c |   42 ++++++++--------------------------
 2 files changed, 13 insertions(+), 31 deletions(-)

Index: linux-2.6/arch/mips/sibyte/sb1250/irq.c
===================================================================
--- linux-2.6.orig/arch/mips/sibyte/sb1250/irq.c
+++ linux-2.6/arch/mips/sibyte/sb1250/irq.c
@@ -350,9 +350,11 @@ void __init arch_init_irq(void)
 #endif
        /* Enable necessary IPs, disable the rest */
        change_c0_status(ST0_IM, imask);
+}
 
 extern void sb1250_timer_interrupt(void);
 extern void sb1250_mailbox_interrupt(void);
+extern void sb1250_kgdb_interrupt(void);
 
 asmlinkage void plat_irq_dispatch(void)
 {
Index: linux-2.6/arch/mips/sibyte/sb1250/kgdb_sibyte.c
===================================================================
--- linux-2.6.orig/arch/mips/sibyte/sb1250/kgdb_sibyte.c
+++ linux-2.6/arch/mips/sibyte/sb1250/kgdb_sibyte.c
@@ -43,28 +43,27 @@ static int kgdb_init_io(void);
 #define        duart_out(reg, val)     csr_out32(val, 
IOADDR(A_DUART_CHANREG(kgdb_port,reg)))
 #define duart_in(reg)          csr_in32(IOADDR(A_DUART_CHANREG(kgdb_port,reg)))
 
-static void kgdb_swarm_write_char(int c)
+static void kgdbsibyte_write_char(u8 c)
 {
        while ((duart_in(R_DUART_STATUS) & M_DUART_TX_RDY) == 0) ;
        duart_out(R_DUART_TX_HOLD, c);
 }
 
-static int kgdb_swarm_read_char(void)
+static int kgdbsibyte_read_char(void)
 {
        int ret_char;
        unsigned int status;
 
-       status = duart_in(R_DUART_STATUS);
-       while ((status & M_DUART_RX_RDY) == 0) {
+       do {
                status = duart_in(R_DUART_STATUS);
-       }
+       } while ((status & M_DUART_RX_RDY) == 0);
 
        /*
         * Check for framing error
         */
        if (status & M_DUART_FRM_ERR) {
                kgdbsibyte_init_duart();
-               kgdb_swarm_write_char('-');
+               kgdbsibyte_write_char('-');
                return '-';
        }
 
@@ -73,9 +72,10 @@ static int kgdb_swarm_read_char(void)
        return ret_char;
 }
 
-void sb1250_kgdb_interrupt(struct pt_regs *regs)
+void sb1250_kgdb_interrupt(void)
 {
        int kgdb_irq = K_INT_UART_0 + kgdb_port;
+
        /*
         * Clear break-change status (allow some time for the remote
         * host to stop the break, since we would see another
@@ -85,25 +85,7 @@ void sb1250_kgdb_interrupt(struct pt_reg
        mdelay(500);
        duart_out(R_DUART_CMD, V_DUART_MISC_CMD_RESET_BREAK_INT |
                  M_DUART_RX_EN | M_DUART_TX_EN);
-       if (kgdb_io_ops.init != kgdb_init_io) {
-               /* Throw away the data if another I/O routine is
-                * active.
-                */
-               unsigned int status;
-
-               status = duart_in(R_DUART_STATUS);
-               while ((status & M_DUART_RX_RDY) == 0) {
-                       status = duart_in(R_DUART_STATUS);
-               }
-               /*
-                * Check for framing error
-                */
-               if (status & M_DUART_FRM_ERR) {
-                       kgdbsibyte_init_duart();
-               }
-               duart_in(R_DUART_RX_HOLD);
-       } else
-               breakpoint();
+       breakpoint();
 
 }
 
@@ -155,10 +137,8 @@ static void __init kgdbsibyte_hookup_irq
 }
 
 struct kgdb_io kgdb_io_ops = {
-       .read_char = kgdb_swarm_read_char,
-       .write_char = kgdb_swarm_write_char,
+       .read_char  = kgdbsibyte_read_char,
+       .write_char = kgdbsibyte_write_char,
        .init = kgdb_init_io,
-       .late_init = kgdbsibyte_hookup_irq,
-       .pre_exception = NULL,
-       .post_exception = NULL
+       .late_init  = kgdbsibyte_hookup_irq,
 };


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Kgdb-bugreport mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/kgdb-bugreport

Reply via email to