• Home
  • History
  • Annotate
  • Line#
  • Navigate
  • Raw
  • Download
  • only in /asuswrt-rt-n18u-9.0.0.4.380.2695/release/src-rt-6.x.4708/linux/linux-2.6/arch/mn10300/kernel/
1###############################################################################
2#
3# 16550 serial Rx interrupt handler for gdbstub I/O
4#
5# Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
6# Written by David Howells (dhowells@redhat.com)
7#
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.
12#
13###############################################################################
14#include <linux/sys.h>
15#include <linux/linkage.h>
16#include <asm/smp.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 <unit/serial.h>
22
23	.text
24
25###############################################################################
26#
27# GDB stub serial receive interrupt entry point
28# - intended to run at interrupt priority 0
29#
30###############################################################################
31	.globl	gdbstub_io_rx_handler
32	.type	gdbstub_io_rx_handler,@function
33gdbstub_io_rx_handler:
34	movm	[d2,d3,a2,a3],(sp)
35
36	movbu	(GDBPORT_SERIAL_IIR),d2
37
38	mov	(gdbstub_rx_inp),a3
39gdbstub_io_rx_more:
40	mov	a3,a2
41	add	2,a3
42	and	0x00000fff,a3
43	mov	(gdbstub_rx_outp),d3
44	cmp	a3,d3
45	beq	gdbstub_io_rx_overflow
46
47	movbu	(GDBPORT_SERIAL_LSR),d3
48	btst	UART_LSR_DR,d3
49	beq	gdbstub_io_rx_done
50	movbu	(GDBPORT_SERIAL_RX),d2
51	movbu	d3,(gdbstub_rx_buffer+1,a2)
52	movbu	d2,(gdbstub_rx_buffer,a2)
53	mov	a3,(gdbstub_rx_inp)
54	bra	gdbstub_io_rx_more
55
56gdbstub_io_rx_done:
57	mov	GxICR_DETECT,d2
58	movbu	d2,(XIRQxICR(GDBPORT_SERIAL_IRQ))	# ACK the interrupt
59	movhu	(XIRQxICR(GDBPORT_SERIAL_IRQ)),d2	# flush
60	movm	(sp),[d2,d3,a2,a3]
61	bset	0x01,(gdbstub_busy)
62	beq	gdbstub_io_rx_enter
63	rti
64
65gdbstub_io_rx_overflow:
66	bset	0x01,(gdbstub_rx_overflow)
67	bra	gdbstub_io_rx_done
68
69gdbstub_io_rx_enter:
70	or	EPSW_IE|EPSW_IM_1,epsw
71	add	-4,sp
72	SAVE_ALL
73
74	mov	0xffffffff,d0
75	mov	d0,(REG_ORIG_D0,fp)
76	mov	0x280,d1
77
78	mov	fp,d0
79	call	gdbstub_rx_irq[],0	# gdbstub_rx_irq(regs,excep)
80
81	and	~EPSW_IE,epsw
82	bclr	0x01,(gdbstub_busy)
83
84	.globl gdbstub_return
85gdbstub_return:
86	RESTORE_ALL
87
88	.size	gdbstub_io_rx_handler,.-gdbstub_io_rx_handler
89