kgdb.S 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. /*
  2. * Copyright (C) 2000 Murray Jensen <Murray.Jensen@cmst.csiro.au>
  3. *
  4. * See file CREDITS for list of people who contributed to this
  5. * project.
  6. *
  7. * This program is free software; you can redistribute it and/or
  8. * modify it under the terms of the GNU General Public License as
  9. * published by the Free Software Foundation; either version 2 of
  10. * the License, or (at your option) any later version.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with this program; if not, write to the Free Software
  19. * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  20. * MA 02111-1307USA
  21. */
  22. #include <config.h>
  23. #include <command.h>
  24. #include <74xx_7xx.h>
  25. #include <version.h>
  26. #include <ppc_asm.tmpl>
  27. #include <ppc_defs.h>
  28. #include <asm/cache.h>
  29. #include <asm/mmu.h>
  30. #if defined(CONFIG_CMD_KGDB)
  31. /*
  32. * cache flushing routines for kgdb
  33. */
  34. .globl kgdb_flush_cache_all
  35. kgdb_flush_cache_all:
  36. lis r3,0
  37. addis r4,r0,0x0040
  38. kgdb_flush_loop:
  39. lwz r5,0(r3)
  40. addi r3,r3,CONFIG_SYS_CACHELINE_SIZE
  41. cmp 0,0,r3,r4
  42. bne kgdb_flush_loop
  43. SYNC
  44. mfspr r3,1008
  45. ori r3,r3,0x8800
  46. mtspr 1008,r3
  47. sync
  48. blr
  49. .globl kgdb_flush_cache_range
  50. kgdb_flush_cache_range:
  51. li r5,CONFIG_SYS_CACHELINE_SIZE-1
  52. andc r3,r3,r5
  53. subf r4,r3,r4
  54. add r4,r4,r5
  55. srwi. r4,r4,CONFIG_SYS_CACHELINE_SHIFT
  56. beqlr
  57. mtctr r4
  58. mr r6,r3
  59. 1: dcbst 0,r3
  60. addi r3,r3,CONFIG_SYS_CACHELINE_SIZE
  61. bdnz 1b
  62. sync /* wait for dcbst's to get to ram */
  63. mtctr r4
  64. 2: icbi 0,r6
  65. addi r6,r6,CONFIG_SYS_CACHELINE_SIZE
  66. bdnz 2b
  67. SYNC
  68. blr
  69. #endif