andes.c
上传用户:lgb322
上传日期:2013-02-24
资源大小:30529k
文件大小:4k
源码类别:

嵌入式Linux

开发平台:

Unix_Linux

  1. /*
  2.  * andes.c: MMU and cache operations for the R10000 (ANDES).
  3.  *
  4.  * Copyright (C) 1996 David S. Miller (dm@engr.sgi.com)
  5.  */
  6. #include <linux/init.h>
  7. #include <linux/kernel.h>
  8. #include <linux/sched.h>
  9. #include <linux/mm.h>
  10. #include <asm/page.h>
  11. #include <asm/pgtable.h>
  12. #include <asm/system.h>
  13. #include <asm/sgialib.h>
  14. #include <asm/mmu_context.h>
  15. /* page functions */
  16. void andes_clear_page(void * page)
  17. {
  18. __asm__ __volatile__(
  19. ".settnoreordernt"
  20. ".settnoatnt"
  21. "addiut$1,%0,%2n"
  22. "1:tswt$0,(%0)nt"
  23. "swt$0,4(%0)nt"
  24. "swt$0,8(%0)nt"
  25. "swt$0,12(%0)nt"
  26. "addiut%0,32nt"
  27. "swt$0,-16(%0)nt"
  28. "swt$0,-12(%0)nt"
  29. "swt$0,-8(%0)nt"
  30. "bnet$1,%0,1bnt"
  31. "swt$0,-4(%0)nt"
  32. ".settatnt"
  33. ".settreorder"
  34. :"=r" (page)
  35. :"0" (page),
  36.  "I" (PAGE_SIZE)
  37. :"$1","memory");
  38. }
  39. static void andes_copy_page(void * to, void * from)
  40. {
  41. unsigned long dummy1, dummy2;
  42. unsigned long reg1, reg2, reg3, reg4;
  43. __asm__ __volatile__(
  44. ".settnoreordernt"
  45. ".settnoatnt"
  46. "addiut$1,%0,%8n"
  47. "1:tlwt%2,(%1)nt"
  48. "lwt%3,4(%1)nt"
  49. "lwt%4,8(%1)nt"
  50. "lwt%5,12(%1)nt"
  51. "swt%2,(%0)nt"
  52. "swt%3,4(%0)nt"
  53. "swt%4,8(%0)nt"
  54. "swt%5,12(%0)nt"
  55. "lwt%2,16(%1)nt"
  56. "lwt%3,20(%1)nt"
  57. "lwt%4,24(%1)nt"
  58. "lwt%5,28(%1)nt"
  59. "swt%2,16(%0)nt"
  60. "swt%3,20(%0)nt"
  61. "swt%4,24(%0)nt"
  62. "swt%5,28(%0)nt"
  63. "addiut%0,64nt"
  64. "addiut%1,64nt"
  65. "lwt%2,-32(%1)nt"
  66. "lwt%3,-28(%1)nt"
  67. "lwt%4,-24(%1)nt"
  68. "lwt%5,-20(%1)nt"
  69. "swt%2,-32(%0)nt"
  70. "swt%3,-28(%0)nt"
  71. "swt%4,-24(%0)nt"
  72. "swt%5,-20(%0)nt"
  73. "lwt%2,-16(%1)nt"
  74. "lwt%3,-12(%1)nt"
  75. "lwt%4,-8(%1)nt"
  76. "lwt%5,-4(%1)nt"
  77. "swt%2,-16(%0)nt"
  78. "swt%3,-12(%0)nt"
  79. "swt%4,-8(%0)nt"
  80. "bnet$1,%0,1bnt"
  81. "swt%5,-4(%0)nt"
  82. ".settatnt"
  83. ".settreorder"
  84. :"=r" (dummy1), "=r" (dummy2),
  85.  "=&r" (reg1), "=&r" (reg2), "=&r" (reg3), "=&r" (reg4)
  86. :"0" (to), "1" (from),
  87.  "I" (PAGE_SIZE));
  88. }
  89. /* Cache operations. XXX Write these dave... */
  90. static inline void andes_flush_cache_all(void)
  91. {
  92. /* XXX */
  93. }
  94. static void andes_flush_cache_mm(struct mm_struct *mm)
  95. {
  96. /* XXX */
  97. }
  98. static void andes_flush_cache_range(struct mm_struct *mm,
  99.     unsigned long start,
  100.     unsigned long end)
  101. {
  102. /* XXX */
  103. }
  104. static void andes_flush_cache_page(struct vm_area_struct *vma,
  105.    unsigned long page)
  106. {
  107. /* XXX */
  108. }
  109. static void andes_flush_page_to_ram(struct page * page)
  110. {
  111. /* XXX */
  112. }
  113. static void __andes_flush_icache_range(unsigned long start, unsigned long end)
  114. {
  115. /* XXX */
  116. }
  117. static void andes_flush_icache_page(struct vm_area_struct *vma,
  118.                                     struct page *page)
  119. {
  120. /* XXX */
  121. }
  122. static void andes_flush_cache_sigtramp(unsigned long page)
  123. {
  124. protected_writeback_dcache_line(addr & ~(dc_lsize - 1));
  125. protected_flush_icache_line(addr & ~(ic_lsize - 1));
  126. }
  127. /* TLB operations. XXX Write these dave... */
  128. void flush_tlb_all(void)
  129. {
  130. /* XXX */
  131. }
  132. void flush_tlb_mm(struct mm_struct *mm)
  133. {
  134. /* XXX */
  135. }
  136. void flush_tlb_range(struct mm_struct *mm, unsigned long start,
  137.   unsigned long end)
  138. {
  139. /* XXX */
  140. }
  141. void flush_tlb_page(struct vm_area_struct *vma, unsigned long page)
  142. {
  143. /* XXX */
  144. }
  145. void pgd_init(unsigned long page)
  146. {
  147. }
  148. void add_wired_entry(unsigned long entrylo0, unsigned long entrylo1,
  149.   unsigned long entryhi, unsigned long pagemask)
  150. {
  151.         /* XXX */
  152. }
  153. void __init ld_mmu_andes(void)
  154. {
  155. _clear_page = andes_clear_page;
  156. _copy_page = andes_copy_page;
  157. _flush_cache_all = andes_flush_cache_all;
  158. ___flush_cache_all = andes_flush_cache_all;
  159. _flush_cache_mm = andes_flush_cache_mm;
  160. _flush_cache_range = andes_flush_cache_range;
  161. _flush_cache_page = andes_flush_cache_page;
  162. _flush_cache_sigtramp = andes_flush_cache_sigtramp;
  163. _flush_page_to_ram = andes_flush_page_to_ram;
  164. _flush_icache_page = andes_flush_icache_page;
  165. _flush_icache_range = andes_flush_icache_range;
  166. write_32bit_cp0_register(CP0_FRAMEMASK, 0);
  167. flush_cache_all();
  168. flush_tlb_all();
  169. /*
  170.  * The R10k might even work for Linux/MIPS - but we're paranoid
  171.  * and refuse to run until this is tested on real silicon
  172.  */
  173. panic("CPU too expensive - making holiday in the ANDES!");
  174. }