gdb-io-serial-low.S 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  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. .text
  24. ###############################################################################
  25. #
  26. # GDB stub serial receive interrupt entry point
  27. # - intended to run at interrupt priority 0
  28. #
  29. ###############################################################################
  30. .globl gdbstub_io_rx_handler
  31. .type gdbstub_io_rx_handler,@function
  32. gdbstub_io_rx_handler:
  33. movm [d2,d3,a2,a3],(sp)
  34. #if 1
  35. movbu (GDBPORT_SERIAL_IIR),d2
  36. #endif
  37. mov (gdbstub_rx_inp),a3
  38. gdbstub_io_rx_more:
  39. mov a3,a2
  40. add 2,a3
  41. and 0x00000fff,a3
  42. mov (gdbstub_rx_outp),d3
  43. cmp a3,d3
  44. beq gdbstub_io_rx_overflow
  45. movbu (GDBPORT_SERIAL_LSR),d3
  46. btst UART_LSR_DR,d3
  47. beq gdbstub_io_rx_done
  48. movbu (GDBPORT_SERIAL_RX),d2
  49. movbu d3,(gdbstub_rx_buffer+1,a2)
  50. movbu d2,(gdbstub_rx_buffer,a2)
  51. mov a3,(gdbstub_rx_inp)
  52. bra gdbstub_io_rx_more
  53. gdbstub_io_rx_done:
  54. mov GxICR_DETECT,d2
  55. movbu d2,(XIRQxICR(GDBPORT_SERIAL_IRQ)) # ACK the interrupt
  56. movhu (XIRQxICR(GDBPORT_SERIAL_IRQ)),d2 # flush
  57. movm (sp),[d2,d3,a2,a3]
  58. bset 0x01,(gdbstub_busy)
  59. beq gdbstub_io_rx_enter
  60. rti
  61. gdbstub_io_rx_overflow:
  62. bset 0x01,(gdbstub_rx_overflow)
  63. bra gdbstub_io_rx_done
  64. gdbstub_io_rx_enter:
  65. LOCAL_CHANGE_INTR_MASK_LEVEL(NUM2EPSW_IM(CONFIG_GDBSTUB_IRQ_LEVEL+1))
  66. add -4,sp
  67. SAVE_ALL
  68. mov 0xffffffff,d0
  69. mov d0,(REG_ORIG_D0,fp)
  70. mov 0x280,d1
  71. mov fp,d0
  72. call gdbstub_rx_irq[],0 # gdbstub_rx_irq(regs,excep)
  73. LOCAL_CLI
  74. bclr 0x01,(gdbstub_busy)
  75. .globl gdbstub_return
  76. gdbstub_return:
  77. RESTORE_ALL
  78. .size gdbstub_io_rx_handler,.-gdbstub_io_rx_handler