kgdb.S 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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-1307 USA
  21. */
  22. #include <config.h>
  23. #include <command.h>
  24. #include <mpc8260.h>
  25. #include <version.h>
  26. #define CONFIG_8260 1 /* needed for Linux kernel header files */
  27. #define _LINUX_CONFIG_H 1 /* avoid reading Linux autoconf.h file */
  28. #include <ppc_asm.tmpl>
  29. #include <ppc_defs.h>
  30. #include <asm/cache.h>
  31. #include <asm/mmu.h>
  32. #if defined(CONFIG_CMD_KGDB)
  33. /*
  34. * cache flushing routines for kgdb
  35. */
  36. .globl kgdb_flush_cache_all
  37. kgdb_flush_cache_all:
  38. mfspr r3, HID0
  39. ori r3, r3, HID0_ICFI|HID0_DCI /* Invalidate All */
  40. SYNC
  41. mtspr HID0, r3
  42. blr
  43. .globl kgdb_flush_cache_range
  44. kgdb_flush_cache_range:
  45. li r5,CFG_CACHELINE_SIZE-1
  46. andc r3,r3,r5
  47. subf r4,r3,r4
  48. add r4,r4,r5
  49. srwi. r4,r4,CFG_CACHELINE_SHIFT
  50. beqlr
  51. mtctr r4
  52. mr r6,r3
  53. 1: dcbst 0,r3
  54. addi r3,r3,CFG_CACHELINE_SIZE
  55. bdnz 1b
  56. sync /* wait for dcbst's to get to ram */
  57. mtctr r4
  58. 2: icbi 0,r6
  59. addi r6,r6,CFG_CACHELINE_SIZE
  60. bdnz 2b
  61. SYNC
  62. blr
  63. #endif