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/irqflags.h>
22 #include <unit/serial.h>
26 ###############################################################################
28 # GDB stub serial receive interrupt entry point
29 # - intended to run at interrupt priority 0
31 ###############################################################################
32 .globl gdbstub_io_rx_handler
33 .type gdbstub_io_rx_handler,@function
34 gdbstub_io_rx_handler:
35 movm [d2,d3,a2,a3],(sp)
38 movbu (GDBPORT_SERIAL_IIR),d2
41 mov (gdbstub_rx_inp),a3
46 mov (gdbstub_rx_outp),d3
48 beq gdbstub_io_rx_overflow
50 movbu (GDBPORT_SERIAL_LSR),d3
52 beq gdbstub_io_rx_done
53 movbu (GDBPORT_SERIAL_RX),d2
54 movbu d3,(gdbstub_rx_buffer+1,a2)
55 movbu d2,(gdbstub_rx_buffer,a2)
56 mov a3,(gdbstub_rx_inp)
57 bra gdbstub_io_rx_more
61 movbu d2,(XIRQxICR(GDBPORT_SERIAL_IRQ)) # ACK the interrupt
62 movhu (XIRQxICR(GDBPORT_SERIAL_IRQ)),d2 # flush
63 movm (sp),[d2,d3,a2,a3]
64 bset 0x01,(gdbstub_busy)
65 beq gdbstub_io_rx_enter
68 gdbstub_io_rx_overflow:
69 bset 0x01,(gdbstub_rx_overflow)
70 bra gdbstub_io_rx_done
73 LOCAL_CHANGE_INTR_MASK_LEVEL(NUM2EPSW_IM(CONFIG_GDBSTUB_IRQ_LEVEL+1))
78 mov d0,(REG_ORIG_D0,fp)
82 call gdbstub_rx_irq[],0 # gdbstub_rx_irq(regs,excep)
85 bclr 0x01,(gdbstub_busy)
91 .size gdbstub_io_rx_handler,.-gdbstub_io_rx_handler