linux/arch/mn10300/kernel/gdb-io-serial-low.S
<<
>>
Prefs
   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 <asm/irqflags.h>
  22#include <unit/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
  34gdbstub_io_rx_handler:
  35        movm    [d2,d3,a2,a3],(sp)
  36
  37#if 1
  38        movbu   (GDBPORT_SERIAL_IIR),d2
  39#endif
  40
  41        mov     (gdbstub_rx_inp),a3
  42gdbstub_io_rx_more:
  43        mov     a3,a2
  44        add     2,a3
  45        and     0x00000fff,a3
  46        mov     (gdbstub_rx_outp),d3
  47        cmp     a3,d3
  48        beq     gdbstub_io_rx_overflow
  49
  50        movbu   (GDBPORT_SERIAL_LSR),d3
  51        btst    UART_LSR_DR,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
  58
  59gdbstub_io_rx_done:
  60        mov     GxICR_DETECT,d2
  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
  66        rti
  67
  68gdbstub_io_rx_overflow:
  69        bset    0x01,(gdbstub_rx_overflow)
  70        bra     gdbstub_io_rx_done
  71
  72gdbstub_io_rx_enter:
  73        LOCAL_CHANGE_INTR_MASK_LEVEL(NUM2EPSW_IM(CONFIG_GDBSTUB_IRQ_LEVEL+1))
  74        add     -4,sp
  75        SAVE_ALL
  76
  77        mov     0xffffffff,d0
  78        mov     d0,(REG_ORIG_D0,fp)
  79        mov     0x280,d1
  80
  81        mov     fp,d0
  82        call    gdbstub_rx_irq[],0      # gdbstub_rx_irq(regs,excep)
  83
  84        LOCAL_CLI
  85        bclr    0x01,(gdbstub_busy)
  86
  87        .globl gdbstub_return
  88gdbstub_return:
  89        RESTORE_ALL
  90
  91        .size   gdbstub_io_rx_handler,.-gdbstub_io_rx_handler
  92