1 ###############################################################################
3 # 16550 serial Rx interrupt handler for gdbstub I/O
5 # Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
6 # Written by David Howells (dhowells@redhat.com)
8 # This program is free software; you can redistribute it and/or
9 # modify it under the terms of the GNU General Public Licence
10 # as published by the Free Software Foundation; either version
11 # 2 of the Licence, or (at your option) any later version.
13 ###############################################################################
14 #include <linux/sys.h>
15 #include <linux/linkage.h>
17 #include <asm/cpu-regs.h>
18 #include <asm/thread_info.h>
19 #include <asm/frame.inc>
20 #include <asm/intctl-regs.h>
21 #include <asm/unit/serial.h>
25 ###############################################################################
27 # GDB stub serial receive interrupt entry point
28 # - intended to run at interrupt priority 0
30 ###############################################################################
31 .globl gdbstub_io_rx_handler
32 .type gdbstub_io_rx_handler,@function
33 gdbstub_io_rx_handler:
34 movm [d2,d3,a2,a3],(sp)
37 movbu (GDBPORT_SERIAL_IIR),d2
40 mov (gdbstub_rx_inp),a3
45 mov (gdbstub_rx_outp),d3
47 beq gdbstub_io_rx_overflow
49 movbu (GDBPORT_SERIAL_LSR),d3
51 beq gdbstub_io_rx_done
52 movbu (GDBPORT_SERIAL_RX),d2
53 movbu d3,(gdbstub_rx_buffer+1,a2)
54 movbu d2,(gdbstub_rx_buffer,a2)
55 mov a3,(gdbstub_rx_inp)
56 bra gdbstub_io_rx_more
60 movbu d2,(XIRQxICR(GDBPORT_SERIAL_IRQ)) # ACK the interrupt
61 movhu (XIRQxICR(GDBPORT_SERIAL_IRQ)),d2 # flush
62 movm (sp),[d2,d3,a2,a3]
63 bset 0x01,(gdbstub_busy)
64 beq gdbstub_io_rx_enter
67 gdbstub_io_rx_overflow:
68 bset 0x01,(gdbstub_rx_overflow)
69 bra gdbstub_io_rx_done
72 or EPSW_IE|EPSW_IM_1,epsw
77 mov d0,(REG_ORIG_D0,fp)
81 call gdbstub_rx_irq[],0 # gdbstub_rx_irq(regs,excep)
84 bclr 0x01,(gdbstub_busy)
90 .size gdbstub_io_rx_handler,.-gdbstub_io_rx_handler