swift.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. /* swift.h: Specific definitions for the _broken_ Swift SRMMU
  2. * MMU module.
  3. *
  4. * Copyright (C) 1996 David S. Miller (davem@caip.rutgers.edu)
  5. */
  6. #ifndef _SPARC_SWIFT_H
  7. #define _SPARC_SWIFT_H
  8. /* Swift is so brain damaged, here is the mmu control register. */
  9. #define SWIFT_ST 0x00800000 /* SW tablewalk enable */
  10. #define SWIFT_WP 0x00400000 /* Watchpoint enable */
  11. /* Branch folding (buggy, disable on production systems!) */
  12. #define SWIFT_BF 0x00200000
  13. #define SWIFT_PMC 0x00180000 /* Page mode control */
  14. #define SWIFT_PE 0x00040000 /* Parity enable */
  15. #define SWIFT_PC 0x00020000 /* Parity control */
  16. #define SWIFT_AP 0x00010000 /* Graphics page mode control (TCX/SX) */
  17. #define SWIFT_AC 0x00008000 /* Alternate Cacheability (see viking.h) */
  18. #define SWIFT_BM 0x00004000 /* Boot mode */
  19. #define SWIFT_RC 0x00003c00 /* DRAM refresh control */
  20. #define SWIFT_IE 0x00000200 /* Instruction cache enable */
  21. #define SWIFT_DE 0x00000100 /* Data cache enable */
  22. #define SWIFT_SA 0x00000080 /* Store Allocate */
  23. #define SWIFT_NF 0x00000002 /* No fault mode */
  24. #define SWIFT_EN 0x00000001 /* MMU enable */
  25. /* Bits [13:5] select one of 512 instruction cache tags */
  26. static inline void swift_inv_insn_tag(unsigned long addr)
  27. {
  28. __asm__ __volatile__("sta %%g0, [%0] %1\n\t"
  29. : /* no outputs */
  30. : "r" (addr), "i" (ASI_M_TXTC_TAG)
  31. : "memory");
  32. }
  33. /* Bits [12:4] select one of 512 data cache tags */
  34. static inline void swift_inv_data_tag(unsigned long addr)
  35. {
  36. __asm__ __volatile__("sta %%g0, [%0] %1\n\t"
  37. : /* no outputs */
  38. : "r" (addr), "i" (ASI_M_DATAC_TAG)
  39. : "memory");
  40. }
  41. static inline void swift_flush_dcache(void)
  42. {
  43. unsigned long addr;
  44. for (addr = 0; addr < 0x2000; addr += 0x10)
  45. swift_inv_data_tag(addr);
  46. }
  47. static inline void swift_flush_icache(void)
  48. {
  49. unsigned long addr;
  50. for (addr = 0; addr < 0x4000; addr += 0x20)
  51. swift_inv_insn_tag(addr);
  52. }
  53. static inline void swift_idflash_clear(void)
  54. {
  55. unsigned long addr;
  56. for (addr = 0; addr < 0x2000; addr += 0x10) {
  57. swift_inv_insn_tag(addr<<1);
  58. swift_inv_data_tag(addr);
  59. }
  60. }
  61. /* Swift is so broken, it isn't even safe to use the following. */
  62. static inline void swift_flush_page(unsigned long page)
  63. {
  64. __asm__ __volatile__("sta %%g0, [%0] %1\n\t"
  65. : /* no outputs */
  66. : "r" (page), "i" (ASI_M_FLUSH_PAGE)
  67. : "memory");
  68. }
  69. static inline void swift_flush_segment(unsigned long addr)
  70. {
  71. __asm__ __volatile__("sta %%g0, [%0] %1\n\t"
  72. : /* no outputs */
  73. : "r" (addr), "i" (ASI_M_FLUSH_SEG)
  74. : "memory");
  75. }
  76. static inline void swift_flush_region(unsigned long addr)
  77. {
  78. __asm__ __volatile__("sta %%g0, [%0] %1\n\t"
  79. : /* no outputs */
  80. : "r" (addr), "i" (ASI_M_FLUSH_REGION)
  81. : "memory");
  82. }
  83. static inline void swift_flush_context(void)
  84. {
  85. __asm__ __volatile__("sta %%g0, [%%g0] %0\n\t"
  86. : /* no outputs */
  87. : "i" (ASI_M_FLUSH_CTX)
  88. : "memory");
  89. }
  90. #endif /* !(_SPARC_SWIFT_H) */