tsunami.S 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. /*
  2. * tsunami.S: High speed MicroSparc-I mmu/cache operations.
  3. *
  4. * Copyright (C) 1997 David S. Miller (davem@caip.rutgers.edu)
  5. */
  6. #include <asm/ptrace.h>
  7. #include <asm/asm-offsets.h>
  8. #include <asm/psr.h>
  9. #include <asm/asi.h>
  10. #include <asm/page.h>
  11. #include <asm/pgtsrmmu.h>
  12. .text
  13. .align 4
  14. .globl tsunami_flush_cache_all, tsunami_flush_cache_mm
  15. .globl tsunami_flush_cache_range, tsunami_flush_cache_page
  16. .globl tsunami_flush_page_to_ram, tsunami_flush_page_for_dma
  17. .globl tsunami_flush_sig_insns
  18. .globl tsunami_flush_tlb_all, tsunami_flush_tlb_mm
  19. .globl tsunami_flush_tlb_range, tsunami_flush_tlb_page
  20. /* Sliiick... */
  21. tsunami_flush_cache_page:
  22. tsunami_flush_cache_range:
  23. ld [%o0 + VMA_VM_MM], %o0
  24. tsunami_flush_cache_mm:
  25. ld [%o0 + AOFF_mm_context], %g2
  26. cmp %g2, -1
  27. be tsunami_flush_cache_out
  28. tsunami_flush_cache_all:
  29. WINDOW_FLUSH(%g4, %g5)
  30. tsunami_flush_page_for_dma:
  31. sta %g0, [%g0] ASI_M_IC_FLCLEAR
  32. sta %g0, [%g0] ASI_M_DC_FLCLEAR
  33. tsunami_flush_cache_out:
  34. tsunami_flush_page_to_ram:
  35. retl
  36. nop
  37. tsunami_flush_sig_insns:
  38. flush %o1
  39. retl
  40. flush %o1 + 4
  41. /* More slick stuff... */
  42. tsunami_flush_tlb_range:
  43. ld [%o0 + VMA_VM_MM], %o0
  44. tsunami_flush_tlb_mm:
  45. ld [%o0 + AOFF_mm_context], %g2
  46. cmp %g2, -1
  47. be tsunami_flush_tlb_out
  48. tsunami_flush_tlb_all:
  49. mov 0x400, %o1
  50. sta %g0, [%o1] ASI_M_FLUSH_PROBE
  51. nop
  52. nop
  53. nop
  54. nop
  55. nop
  56. tsunami_flush_tlb_out:
  57. retl
  58. nop
  59. /* This one can be done in a fine grained manner... */
  60. tsunami_flush_tlb_page:
  61. ld [%o0 + VMA_VM_MM], %o0
  62. mov SRMMU_CTX_REG, %g1
  63. ld [%o0 + AOFF_mm_context], %o3
  64. andn %o1, (PAGE_SIZE - 1), %o1
  65. cmp %o3, -1
  66. be tsunami_flush_tlb_page_out
  67. lda [%g1] ASI_M_MMUREGS, %g5
  68. sta %o3, [%g1] ASI_M_MMUREGS
  69. sta %g0, [%o1] ASI_M_FLUSH_PROBE
  70. nop
  71. nop
  72. nop
  73. nop
  74. nop
  75. tsunami_flush_tlb_page_out:
  76. retl
  77. sta %g5, [%g1] ASI_M_MMUREGS
  78. #define MIRROR_BLOCK(dst, src, offset, t0, t1, t2, t3) \
  79. ldd [src + offset + 0x18], t0; \
  80. std t0, [dst + offset + 0x18]; \
  81. ldd [src + offset + 0x10], t2; \
  82. std t2, [dst + offset + 0x10]; \
  83. ldd [src + offset + 0x08], t0; \
  84. std t0, [dst + offset + 0x08]; \
  85. ldd [src + offset + 0x00], t2; \
  86. std t2, [dst + offset + 0x00];
  87. tsunami_copy_1page:
  88. /* NOTE: This routine has to be shorter than 70insns --jj */
  89. or %g0, (PAGE_SIZE >> 8), %g1
  90. 1:
  91. MIRROR_BLOCK(%o0, %o1, 0x00, %o2, %o3, %o4, %o5)
  92. MIRROR_BLOCK(%o0, %o1, 0x20, %o2, %o3, %o4, %o5)
  93. MIRROR_BLOCK(%o0, %o1, 0x40, %o2, %o3, %o4, %o5)
  94. MIRROR_BLOCK(%o0, %o1, 0x60, %o2, %o3, %o4, %o5)
  95. MIRROR_BLOCK(%o0, %o1, 0x80, %o2, %o3, %o4, %o5)
  96. MIRROR_BLOCK(%o0, %o1, 0xa0, %o2, %o3, %o4, %o5)
  97. MIRROR_BLOCK(%o0, %o1, 0xc0, %o2, %o3, %o4, %o5)
  98. MIRROR_BLOCK(%o0, %o1, 0xe0, %o2, %o3, %o4, %o5)
  99. subcc %g1, 1, %g1
  100. add %o0, 0x100, %o0
  101. bne 1b
  102. add %o1, 0x100, %o1
  103. .globl tsunami_setup_blockops
  104. tsunami_setup_blockops:
  105. sethi %hi(__copy_1page), %o0
  106. or %o0, %lo(__copy_1page), %o0
  107. sethi %hi(tsunami_copy_1page), %o1
  108. or %o1, %lo(tsunami_copy_1page), %o1
  109. sethi %hi(tsunami_setup_blockops), %o2
  110. or %o2, %lo(tsunami_setup_blockops), %o2
  111. ld [%o1], %o4
  112. 1: add %o1, 4, %o1
  113. st %o4, [%o0]
  114. add %o0, 4, %o0
  115. cmp %o1, %o2
  116. bne 1b
  117. ld [%o1], %o4
  118. sta %g0, [%g0] ASI_M_IC_FLCLEAR
  119. sta %g0, [%g0] ASI_M_DC_FLCLEAR
  120. retl
  121. nop