1 /* SPDX-License-Identifier: GPL-2.0 */
5 #ifdef CONFIG_METAG_USER_TCM
6 #include <linux/list.h>
9 #ifdef CONFIG_HUGETLB_PAGE
14 /* Software pgd base pointer used for Meta 1.x MMU. */
15 unsigned long pgd_base
;
16 #ifdef CONFIG_METAG_USER_TCM
19 #ifdef CONFIG_HUGETLB_PAGE
20 #if HPAGE_SHIFT < HUGEPT_SHIFT
21 /* last partially filled huge page table address */
22 unsigned long part_huge
;
27 /* Given a virtual address, return the pte for the top level 4meg entry
28 * that maps that address.
29 * Returns 0 (an empty pte) if that range is not mapped.
31 unsigned long mmu_read_first_level_page(unsigned long vaddr
);
33 /* Given a linear (virtual) address, return the second level 4k pte
34 * that maps that address. Returns 0 if the address is not mapped.
36 unsigned long mmu_read_second_level_page(unsigned long vaddr
);
38 /* Get the virtual base address of the MMU */
39 unsigned long mmu_get_base(void);
41 /* Initialize the MMU. */
42 void mmu_init(unsigned long mem_end
);
44 #ifdef CONFIG_METAG_META21_MMU
46 * For cpu "cpu" calculate and return the address of the
47 * MMCU_TnLOCAL_TABLE_PHYS0 if running in local-space or
48 * MMCU_TnGLOBAL_TABLE_PHYS0 if running in global-space.
50 static inline unsigned long mmu_phys0_addr(unsigned int cpu
)
54 phys0
= (MMCU_T0LOCAL_TABLE_PHYS0
+
55 (MMCU_TnX_TABLE_PHYSX_STRIDE
* cpu
)) +
56 (MMCU_TXG_TABLE_PHYSX_OFFSET
* is_global_space(PAGE_OFFSET
));
62 * For cpu "cpu" calculate and return the address of the
63 * MMCU_TnLOCAL_TABLE_PHYS1 if running in local-space or
64 * MMCU_TnGLOBAL_TABLE_PHYS1 if running in global-space.
66 static inline unsigned long mmu_phys1_addr(unsigned int cpu
)
70 phys1
= (MMCU_T0LOCAL_TABLE_PHYS1
+
71 (MMCU_TnX_TABLE_PHYSX_STRIDE
* cpu
)) +
72 (MMCU_TXG_TABLE_PHYSX_OFFSET
* is_global_space(PAGE_OFFSET
));
76 #endif /* CONFIG_METAG_META21_MMU */