Subversion Repositories HelenOS

Rev

Rev 1787 | Rev 1823 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1787 Rev 1822
Line 24... Line 24...
24
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
 */
27
 */
28
 
28
 
29
 /** @addtogroup sparc64mm 
29
/** @addtogroup sparc64mm  
30
 * @{
30
 * @{
31
 */
31
 */
32
/** @file
32
/** @file
33
 */
33
 */
34
 
34
 
35
#ifndef __sparc64_MMU_H__
35
#ifndef __sparc64_MMU_H__
36
#define __sparc64_MMU_H__
36
#define __sparc64_MMU_H__
37
 
37
 
38
#include <arch/asm.h>
-
 
39
#include <arch/barrier.h>
-
 
40
#include <arch/types.h>
-
 
41
#include <typedefs.h>
-
 
42
 
-
 
43
/** LSU Control Register ASI. */
38
/** LSU Control Register ASI. */
44
#define ASI_LSU_CONTROL_REG     0x45    /**< Load/Store Unit Control Register. */
39
#define ASI_LSU_CONTROL_REG     0x45    /**< Load/Store Unit Control Register. */
45
 
40
 
46
/** I-MMU ASIs. */
41
/** I-MMU ASIs. */
47
#define ASI_IMMU            0x50
42
#define ASI_IMMU            0x50
Line 77... Line 72...
77
#define VA_DMMU_TSB_BASE        0x28    /**< DMMU TSB base register. */
72
#define VA_DMMU_TSB_BASE        0x28    /**< DMMU TSB base register. */
78
#define VA_DMMU_TAG_ACCESS      0x30    /**< DMMU TLB tag access register. */
73
#define VA_DMMU_TAG_ACCESS      0x30    /**< DMMU TLB tag access register. */
79
#define VA_DMMU_VA_WATCHPOINT_REG   0x38    /**< DMMU VA data watchpoint register. */
74
#define VA_DMMU_VA_WATCHPOINT_REG   0x38    /**< DMMU VA data watchpoint register. */
80
#define VA_DMMU_PA_WATCHPOINT_REG   0x40    /**< DMMU PA data watchpoint register. */
75
#define VA_DMMU_PA_WATCHPOINT_REG   0x40    /**< DMMU PA data watchpoint register. */
81
 
76
 
-
 
77
#ifndef __ASM__
-
 
78
 
-
 
79
#include <arch/asm.h>
-
 
80
#include <arch/barrier.h>
-
 
81
#include <arch/types.h>
-
 
82
#include <typedefs.h>
82
 
83
 
83
/** LSU Control Register. */
84
/** LSU Control Register. */
84
union lsu_cr_reg {
85
union lsu_cr_reg {
85
    uint64_t value;
86
    uint64_t value;
86
    struct {
87
    struct {
Line 100... Line 101...
100
       
101
       
101
    } __attribute__ ((packed));
102
    } __attribute__ ((packed));
102
};
103
};
103
typedef union lsu_cr_reg lsu_cr_reg_t;
104
typedef union lsu_cr_reg lsu_cr_reg_t;
104
 
105
 
105
 
-
 
106
#define immu_enable()   immu_set(true)
-
 
107
#define immu_disable()  immu_set(false)
-
 
108
#define dmmu_enable()   dmmu_set(true)
-
 
109
#define dmmu_disable()  dmmu_set(false)
-
 
110
 
-
 
111
/** Disable or Enable IMMU. */
106
#endif /* !__ASM__ */
112
static inline void immu_set(bool enable)
-
 
113
{
-
 
114
    lsu_cr_reg_t cr;
-
 
115
   
-
 
116
    cr.value = asi_u64_read(ASI_LSU_CONTROL_REG, 0);
-
 
117
    cr.im = enable;
-
 
118
    asi_u64_write(ASI_LSU_CONTROL_REG, 0, cr.value);
-
 
119
    membar();
-
 
120
}
-
 
121
 
-
 
122
/** Disable or Enable DMMU. */
-
 
123
static inline void dmmu_set(bool enable)
-
 
124
{
-
 
125
    lsu_cr_reg_t cr;
-
 
126
   
-
 
127
    cr.value = asi_u64_read(ASI_LSU_CONTROL_REG, 0);
-
 
128
    cr.dm = enable;
-
 
129
    asi_u64_write(ASI_LSU_CONTROL_REG, 0, cr.value);
-
 
130
    membar();
-
 
131
}
-
 
132
 
107
 
133
#endif
108
#endif
134
 
109
 
135
 /** @}
110
/** @}
136
 */
111
 */
137
 
-