1f15cbe6fSPaul Mundt #ifndef __ASM_SH_MMU_CONTEXT_32_H
2f15cbe6fSPaul Mundt #define __ASM_SH_MMU_CONTEXT_32_H
3f15cbe6fSPaul Mundt 
4f15cbe6fSPaul Mundt /*
5f15cbe6fSPaul Mundt  * Destroy context related info for an mm_struct that is about
6f15cbe6fSPaul Mundt  * to be put to rest.
7f15cbe6fSPaul Mundt  */
8f15cbe6fSPaul Mundt static inline void destroy_context(struct mm_struct *mm)
9f15cbe6fSPaul Mundt {
10f15cbe6fSPaul Mundt 	/* Do nothing */
11f15cbe6fSPaul Mundt }
12f15cbe6fSPaul Mundt 
13f15cbe6fSPaul Mundt static inline void set_asid(unsigned long asid)
14f15cbe6fSPaul Mundt {
15f15cbe6fSPaul Mundt 	unsigned long __dummy;
16f15cbe6fSPaul Mundt 
17f15cbe6fSPaul Mundt 	__asm__ __volatile__ ("mov.l	%2, %0\n\t"
18f15cbe6fSPaul Mundt 			      "and	%3, %0\n\t"
19f15cbe6fSPaul Mundt 			      "or	%1, %0\n\t"
20f15cbe6fSPaul Mundt 			      "mov.l	%0, %2"
21f15cbe6fSPaul Mundt 			      : "=&r" (__dummy)
22f15cbe6fSPaul Mundt 			      : "r" (asid), "m" (__m(MMU_PTEH)),
23f15cbe6fSPaul Mundt 			        "r" (0xffffff00));
24f15cbe6fSPaul Mundt }
25f15cbe6fSPaul Mundt 
26f15cbe6fSPaul Mundt static inline unsigned long get_asid(void)
27f15cbe6fSPaul Mundt {
28f15cbe6fSPaul Mundt 	unsigned long asid;
29f15cbe6fSPaul Mundt 
30f15cbe6fSPaul Mundt 	__asm__ __volatile__ ("mov.l	%1, %0"
31f15cbe6fSPaul Mundt 			      : "=r" (asid)
32f15cbe6fSPaul Mundt 			      : "m" (__m(MMU_PTEH)));
33f15cbe6fSPaul Mundt 	asid &= MMU_CONTEXT_ASID_MASK;
34f15cbe6fSPaul Mundt 	return asid;
35f15cbe6fSPaul Mundt }
36f15cbe6fSPaul Mundt 
37f15cbe6fSPaul Mundt /* MMU_TTB is used for optimizing the fault handling. */
38f15cbe6fSPaul Mundt static inline void set_TTB(pgd_t *pgd)
39f15cbe6fSPaul Mundt {
40f15cbe6fSPaul Mundt 	ctrl_outl((unsigned long)pgd, MMU_TTB);
41f15cbe6fSPaul Mundt }
42f15cbe6fSPaul Mundt 
43f15cbe6fSPaul Mundt static inline pgd_t *get_TTB(void)
44f15cbe6fSPaul Mundt {
45f15cbe6fSPaul Mundt 	return (pgd_t *)ctrl_inl(MMU_TTB);
46f15cbe6fSPaul Mundt }
47f15cbe6fSPaul Mundt #endif /* __ASM_SH_MMU_CONTEXT_32_H */
48