| David Howells | b920de1 | 2008-02-08 04:19:31 -0800 | [diff] [blame] | 1 | ############################################################################### | 
|  | 2 | # | 
|  | 3 | # MN10300 On-chip serial Rx interrupt handler for GDB stub 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/thread_info.h> | 
|  | 18 | #include <asm/cpu-regs.h> | 
|  | 19 | #include <asm/frame.inc> | 
|  | 20 | #include <asm/intctl-regs.h> | 
|  | 21 | #include <asm/unit/serial.h> | 
|  | 22 | #include "mn10300-serial.h" | 
|  | 23 |  | 
|  | 24 | .text | 
|  | 25 |  | 
|  | 26 | ############################################################################### | 
|  | 27 | # | 
|  | 28 | # GDB stub serial receive interrupt entry point | 
|  | 29 | # - intended to run at interrupt priority 0 | 
|  | 30 | # | 
|  | 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) | 
|  | 36 |  | 
|  | 37 | mov	(gdbstub_rx_inp),a3 | 
|  | 38 | gdbstub_io_rx_more: | 
|  | 39 | mov	a3,a2 | 
|  | 40 | add	2,a3 | 
|  | 41 | and	PAGE_SIZE_asm-1,a3 | 
|  | 42 | mov	(gdbstub_rx_outp),d3 | 
|  | 43 | cmp	a3,d3 | 
|  | 44 | beq	gdbstub_io_rx_overflow | 
|  | 45 |  | 
|  | 46 | movbu	(SCgSTR),d3 | 
|  | 47 | btst	SC01STR_RBF,d3 | 
|  | 48 | beq	gdbstub_io_rx_done | 
|  | 49 | movbu	(SCgRXB),d2 | 
|  | 50 | movbu	d3,(gdbstub_rx_buffer+1,a2) | 
|  | 51 | movbu	d2,(gdbstub_rx_buffer,a2) | 
|  | 52 | mov	a3,(gdbstub_rx_inp) | 
|  | 53 | bra	gdbstub_io_rx_more | 
|  | 54 |  | 
|  | 55 | gdbstub_io_rx_done: | 
|  | 56 | mov	GxICR_DETECT,d2 | 
|  | 57 | movbu	d2,(GxICR(SCgRXIRQ))	# ACK the interrupt | 
|  | 58 | movhu	(GxICR(SCgRXIRQ)),d2	# flush | 
|  | 59 |  | 
|  | 60 | movm	(sp),[d2,d3,a2,a3] | 
|  | 61 | bset	0x01,(gdbstub_busy) | 
|  | 62 | beq	gdbstub_io_rx_enter | 
|  | 63 | rti | 
|  | 64 |  | 
|  | 65 | gdbstub_io_rx_overflow: | 
|  | 66 | bset	0x01,(gdbstub_rx_overflow) | 
|  | 67 | bra	gdbstub_io_rx_done | 
|  | 68 |  | 
|  | 69 | ############################################################################### | 
|  | 70 | # | 
|  | 71 | # debugging interrupt - enter the GDB stub proper | 
|  | 72 | # | 
|  | 73 | ############################################################################### | 
|  | 74 | gdbstub_io_rx_enter: | 
|  | 75 | or	EPSW_IE|EPSW_IM_1,epsw | 
|  | 76 | add	-4,sp | 
|  | 77 | SAVE_ALL | 
|  | 78 |  | 
|  | 79 | mov	0xffffffff,d0 | 
|  | 80 | mov	d0,(REG_ORIG_D0,fp) | 
|  | 81 | mov	0x280,d1 | 
|  | 82 |  | 
|  | 83 | mov	fp,d0 | 
|  | 84 | call	gdbstub_rx_irq[],0	# gdbstub_io_rx_irq(regs,excep) | 
|  | 85 |  | 
|  | 86 | and	~EPSW_IE,epsw | 
|  | 87 | bclr	0x01,(gdbstub_busy) | 
|  | 88 |  | 
|  | 89 | .globl gdbstub_return | 
|  | 90 | gdbstub_return: | 
|  | 91 | RESTORE_ALL | 
|  | 92 |  | 
|  | 93 | .size	gdbstub_io_rx_handler,.-gdbstub_io_rx_handler |