00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00035 #ifndef __sparc64_MMU_H__
00036 #define __sparc64_MMU_H__
00037
00038 #include <arch/asm.h>
00039 #include <arch/barrier.h>
00040 #include <arch/types.h>
00041 #include <typedefs.h>
00042
00044 #define ASI_LSU_CONTROL_REG 0x45
00047 #define ASI_IMMU 0x50
00048 #define ASI_IMMU_TSB_8KB_PTR_REG 0x51
00049 #define ASI_IMMU_TSB_64KB_PTR_REG 0x52
00050 #define ASI_ITLB_DATA_IN_REG 0x54
00051 #define ASI_ITLB_DATA_ACCESS_REG 0x55
00052 #define ASI_ITLB_TAG_READ_REG 0x56
00053 #define ASI_IMMU_DEMAP 0x57
00054
00056 #define VA_IMMU_TAG_TARGET 0x0
00057 #define VA_IMMU_SFSR 0x18
00058 #define VA_IMMU_TSB_BASE 0x28
00059 #define VA_IMMU_TAG_ACCESS 0x30
00062 #define ASI_DMMU 0x58
00063 #define ASI_DMMU_TSB_8KB_PTR_REG 0x59
00064 #define ASI_DMMU_TSB_64KB_PTR_REG 0x5a
00065 #define ASI_DMMU_TSB_DIRECT_PTR_REG 0x5b
00066 #define ASI_DTLB_DATA_IN_REG 0x5c
00067 #define ASI_DTLB_DATA_ACCESS_REG 0x5d
00068 #define ASI_DTLB_TAG_READ_REG 0x5e
00069 #define ASI_DMMU_DEMAP 0x5f
00070
00072 #define VA_DMMU_TAG_TARGET 0x0
00073 #define VA_PRIMARY_CONTEXT_REG 0x8
00074 #define VA_SECONDARY_CONTEXT_REG 0x10
00075 #define VA_DMMU_SFSR 0x18
00076 #define VA_DMMU_SFAR 0x20
00077 #define VA_DMMU_TSB_BASE 0x28
00078 #define VA_DMMU_TAG_ACCESS 0x30
00079 #define VA_DMMU_VA_WATCHPOINT_REG 0x38
00080 #define VA_DMMU_PA_WATCHPOINT_REG 0x40
00084 union lsu_cr_reg {
00085 __u64 value;
00086 struct {
00087 unsigned : 23;
00088 unsigned pm : 8;
00089 unsigned vm : 8;
00090 unsigned pr : 1;
00091 unsigned pw : 1;
00092 unsigned vr : 1;
00093 unsigned vw : 1;
00094 unsigned : 1;
00095 unsigned fm : 16;
00096 unsigned dm : 1;
00097 unsigned im : 1;
00098 unsigned dc : 1;
00099 unsigned ic : 1;
00101 } __attribute__ ((packed));
00102 };
00103 typedef union lsu_cr_reg lsu_cr_reg_t;
00104
00105
00106 #define immu_enable() immu_set(true)
00107 #define immu_disable() immu_set(false)
00108 #define dmmu_enable() dmmu_set(true)
00109 #define dmmu_disable() dmmu_set(false)
00110
00112 static inline void immu_set(bool enable)
00113 {
00114 lsu_cr_reg_t cr;
00115
00116 cr.value = asi_u64_read(ASI_LSU_CONTROL_REG, 0);
00117 cr.im = enable;
00118 asi_u64_write(ASI_LSU_CONTROL_REG, 0, cr.value);
00119 membar();
00120 }
00121
00123 static inline void dmmu_set(bool enable)
00124 {
00125 lsu_cr_reg_t cr;
00126
00127 cr.value = asi_u64_read(ASI_LSU_CONTROL_REG, 0);
00128 cr.dm = enable;
00129 asi_u64_write(ASI_LSU_CONTROL_REG, 0, cr.value);
00130 membar();
00131 }
00132
00133 #endif
00134