cache.S 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. /*
  2. * (C) Copyright 2004, Psyent Corporation <www.psyent.com>
  3. * Scott McNutt <smcnutt@psyent.com>
  4. *
  5. * See file CREDITS for list of people who contributed to this
  6. * project.
  7. *
  8. * This program is free software; you can redistribute it and/or
  9. * modify it under the terms of the GNU General Public License as
  10. * published by the Free Software Foundation; either version 2 of
  11. * the License, or (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program; if not, write to the Free Software
  20. * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  21. * MA 02111-1307 USA
  22. */
  23. #include <config.h>
  24. .text
  25. .global flush_dcache
  26. flush_dcache:
  27. add r5, r5, r4
  28. movhi r8, %hi(CONFIG_SYS_DCACHELINE_SIZE)
  29. ori r8, r8, %lo(CONFIG_SYS_DCACHELINE_SIZE)
  30. 0: flushd 0(r4)
  31. add r4, r4, r8
  32. bltu r4, r5, 0b
  33. ret
  34. .global flush_icache
  35. flush_icache:
  36. add r5, r5, r4
  37. movhi r8, %hi(CONFIG_SYS_ICACHELINE_SIZE)
  38. ori r8, r8, %lo(CONFIG_SYS_ICACHELINE_SIZE)
  39. 1: flushi r4
  40. add r4, r4, r8
  41. bltu r4, r5, 1b
  42. ret
  43. .global flush_cache
  44. flush_cache:
  45. add r5, r5, r4
  46. mov r9, r4
  47. mov r10, r5
  48. movhi r8, %hi(CONFIG_SYS_DCACHELINE_SIZE)
  49. ori r8, r8, %lo(CONFIG_SYS_DCACHELINE_SIZE)
  50. 0: flushd 0(r4)
  51. add r4, r4, r8
  52. bltu r4, r5, 0b
  53. mov r4, r9
  54. mov r5, r10
  55. movhi r8, %hi(CONFIG_SYS_ICACHELINE_SIZE)
  56. ori r8, r8, %lo(CONFIG_SYS_ICACHELINE_SIZE)
  57. 1: flushi r4
  58. add r4, r4, r8
  59. bltu r4, r5, 1b
  60. sync
  61. flushp
  62. ret