cache.S 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. /* cache.S: cache management routines
  2. *
  3. * Copyright (C) 2004 Red Hat, Inc. All Rights Reserved.
  4. * Written by David Howells (dhowells@redhat.com)
  5. *
  6. * This program is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU General Public License
  8. * as published by the Free Software Foundation; either version
  9. * 2 of the License, or (at your option) any later version.
  10. */
  11. #include <asm/spr-regs.h>
  12. #include <asm/cache.h>
  13. .text
  14. .p2align 4
  15. ###############################################################################
  16. #
  17. # Write back a range of dcache
  18. # - void frv_dcache_writeback(unsigned long start [GR8], unsigned long size [GR9])
  19. #
  20. ###############################################################################
  21. .globl frv_dcache_writeback
  22. .type frv_dcache_writeback,@function
  23. frv_dcache_writeback:
  24. andi gr8,~(L1_CACHE_BYTES-1),gr8
  25. 2: dcf @(gr8,gr0)
  26. addi gr8,#L1_CACHE_BYTES,gr8
  27. cmp gr9,gr8,icc0
  28. bhi icc0,#2,2b
  29. membar
  30. bralr
  31. .size frv_dcache_writeback, .-frv_dcache_writeback
  32. ##############################################################################
  33. #
  34. # Invalidate a range of dcache and icache
  35. # - void frv_cache_invalidate(unsigned long start [GR8], unsigned long end [GR9]);
  36. #
  37. ###############################################################################
  38. .globl frv_cache_invalidate
  39. .type frv_cache_invalidate,@function
  40. frv_cache_invalidate:
  41. andi gr8,~(L1_CACHE_BYTES-1),gr8
  42. 2: dci @(gr8,gr0)
  43. ici @(gr8,gr0)
  44. addi gr8,#L1_CACHE_BYTES,gr8
  45. cmp gr9,gr8,icc0
  46. bhi icc0,#2,2b
  47. membar
  48. bralr
  49. .size frv_cache_invalidate, .-frv_cache_invalidate
  50. ##############################################################################
  51. #
  52. # Invalidate a range of icache
  53. # - void frv_icache_invalidate(unsigned long start [GR8], unsigned long end [GR9]);
  54. #
  55. ###############################################################################
  56. .globl frv_icache_invalidate
  57. .type frv_icache_invalidate,@function
  58. frv_icache_invalidate:
  59. andi gr8,~(L1_CACHE_BYTES-1),gr8
  60. 2: ici @(gr8,gr0)
  61. addi gr8,#L1_CACHE_BYTES,gr8
  62. cmp gr9,gr8,icc0
  63. bhi icc0,#2,2b
  64. membar
  65. bralr
  66. .size frv_icache_invalidate, .-frv_icache_invalidate
  67. ###############################################################################
  68. #
  69. # Write back and invalidate a range of dcache and icache
  70. # - void frv_cache_wback_inv(unsigned long start [GR8], unsigned long end [GR9])
  71. #
  72. ###############################################################################
  73. .globl frv_cache_wback_inv
  74. .type frv_cache_wback_inv,@function
  75. frv_cache_wback_inv:
  76. andi gr8,~(L1_CACHE_BYTES-1),gr8
  77. 2: dcf @(gr8,gr0)
  78. ici @(gr8,gr0)
  79. addi gr8,#L1_CACHE_BYTES,gr8
  80. cmp gr9,gr8,icc0
  81. bhi icc0,#2,2b
  82. membar
  83. bralr
  84. .size frv_cache_wback_inv, .-frv_cache_wback_inv