c-andes.c
上传用户:jlfgdled
上传日期:2013-04-10
资源大小:33168k
文件大小:3k
源码类别:

Linux/Unix编程

开发平台:

Unix_Linux

  1. /*
  2.  * This file is subject to the terms and conditions of the GNU General Public
  3.  * License.  See the file "COPYING" in the main directory of this archive
  4.  * for more details.
  5.  *
  6.  * Copyright (C) 1997, 1998, 1999 Ralf Baechle (ralf@gnu.org)
  7.  * Copyright (C) 1999 Silicon Graphics, Inc.
  8.  * Copyright (C) 2000 Kanoj Sarcar (kanoj@sgi.com)
  9.  */
  10. #include <linux/init.h>
  11. #include <linux/kernel.h>
  12. #include <linux/sched.h>
  13. #include <linux/mm.h>
  14. #include <asm/page.h>
  15. #include <asm/pgtable.h>
  16. #include <asm/r10kcache.h>
  17. #include <asm/system.h>
  18. #include <asm/sgialib.h>
  19. #include <asm/mmu_context.h>
  20. static int scache_lsz64;
  21. static void andes_flush_cache_all(void)
  22. {
  23. }
  24. static void andes_flush_cache_mm(struct mm_struct *mm)
  25. {
  26. }
  27. static void andes_flush_cache_range(struct mm_struct *mm, unsigned long start,
  28.                                     unsigned long end)
  29. {
  30. }
  31. static void andes_flush_cache_page(struct vm_area_struct *vma,
  32.                                    unsigned long page)
  33. {
  34. }
  35. static void andes_flush_page_to_ram(struct page *page)
  36. {
  37. }
  38. /* Cache operations.  These are only used with the virtual memory system,
  39.    not for non-coherent I/O so it's ok to ignore the secondary caches.  */
  40. static void
  41. andes_flush_cache_l1(void)
  42. {
  43. blast_dcache32(); blast_icache64();
  44. }
  45. /*
  46.  * This is only used during initialization time. vmalloc() also calls
  47.  * this, but that will be changed pretty soon.
  48.  */
  49. static void
  50. andes_flush_cache_l2(void)
  51. {
  52. switch (sc_lsize()) {
  53. case 64:
  54. blast_scache64();
  55. break;
  56. case 128:
  57. blast_scache128();
  58. break;
  59. default:
  60. printk("Unknown L2 line sizen");
  61. while(1);
  62. }
  63. }
  64. static void andes___flush_cache_all(void)
  65. {
  66. andes_flush_cache_l1();
  67. andes_flush_cache_l2();
  68. }
  69. void
  70. andes_flush_icache_page(unsigned long page)
  71. {
  72. if (scache_lsz64)
  73. blast_scache64_page(page);
  74. else
  75. blast_scache128_page(page);
  76. }
  77. static void
  78. andes_flush_cache_sigtramp(unsigned long addr)
  79. {
  80. protected_writeback_dcache_line(addr & ~(dc_lsize - 1));
  81. protected_flush_icache_line(addr & ~(ic_lsize - 1));
  82. }
  83. void __init ld_mmu_andes(void)
  84. {
  85. printk("Primary instruction cache %dkb, linesize %d bytesn",
  86.        icache_size >> 10, ic_lsize);
  87. printk("Primary data cache %dkb, linesize %d bytesn",
  88.        dcache_size >> 10, dc_lsize);
  89. printk("Secondary cache sized at %ldK, linesize %ldn",
  90.        scache_size() >> 10, sc_lsize());
  91. _clear_page = andes_clear_page;
  92. _copy_page = andes_copy_page;
  93. _flush_cache_all = andes_flush_cache_all;
  94. ___flush_cache_all = andes___flush_cache_all;
  95. _flush_cache_mm = andes_flush_cache_mm;
  96. _flush_cache_page = andes_flush_cache_page;
  97. _flush_page_to_ram = andes_flush_page_to_ram;
  98. _flush_cache_l1 = andes_flush_cache_l1;
  99. _flush_cache_l2 = andes_flush_cache_l2;
  100. _flush_cache_sigtramp = andes_flush_cache_sigtramp;
  101. switch (sc_lsize()) {
  102. case 64:
  103. scache_lsz64 = 1;
  104. break;
  105. case 128:
  106. scache_lsz64 = 0;
  107. break;
  108. default:
  109. printk("Unknown L2 line sizen");
  110. while(1);
  111. }
  112.         flush_cache_l1();
  113. }