1 /* SPDX-License-Identifier: GPL-2.0 */
2 /* Assembler variants of srmmu access functions.
3 * Implemented in assembler to allow run-time patching.
4 * LEON uses a different ASI for MMUREGS than SUN.
6 * The leon_1insn_patch infrastructure is used
7 * for the run-time patching.
10 #include <linux/linkage.h>
12 #include <asm/asmmacro.h>
13 #include <asm/pgtsrmmu.h>
16 /* unsigned int srmmu_get_mmureg(void) */
17 ENTRY(srmmu_get_mmureg)
18 LEON_PI(lda [%g0] ASI_LEON_MMUREGS, %o0)
19 SUN_PI_(lda [%g0] ASI_M_MMUREGS, %o0)
22 ENDPROC(srmmu_get_mmureg)
24 /* void srmmu_set_mmureg(unsigned long regval) */
25 ENTRY(srmmu_set_mmureg)
26 LEON_PI(sta %o0, [%g0] ASI_LEON_MMUREGS)
27 SUN_PI_(sta %o0, [%g0] ASI_M_MMUREGS)
30 ENDPROC(srmmu_set_mmureg)
32 /* void srmmu_set_ctable_ptr(unsigned long paddr) */
33 ENTRY(srmmu_set_ctable_ptr)
34 /* paddr = ((paddr >> 4) & SRMMU_CTX_PMASK); */
36 and %g1, SRMMU_CTX_PMASK, %g1
38 mov SRMMU_CTXTBL_PTR, %g2
39 LEON_PI(sta %g1, [%g2] ASI_LEON_MMUREGS)
40 SUN_PI_(sta %g1, [%g2] ASI_M_MMUREGS)
43 ENDPROC(srmmu_set_ctable_ptr)
46 /* void srmmu_set_context(int context) */
47 ENTRY(srmmu_set_context)
48 mov SRMMU_CTX_REG, %g1
49 LEON_PI(sta %o0, [%g1] ASI_LEON_MMUREGS)
50 SUN_PI_(sta %o0, [%g1] ASI_M_MMUREGS)
53 ENDPROC(srmmu_set_context)
56 /* int srmmu_get_context(void) */
57 ENTRY(srmmu_get_context)
58 mov SRMMU_CTX_REG, %o0
59 LEON_PI(lda [%o0] ASI_LEON_MMUREGS, %o0)
60 SUN_PI_(lda [%o0] ASI_M_MMUREGS, %o0)
63 ENDPROC(srmmu_get_context)
66 /* unsigned int srmmu_get_fstatus(void) */
67 ENTRY(srmmu_get_fstatus)
68 mov SRMMU_FAULT_STATUS, %o0
69 LEON_PI(lda [%o0] ASI_LEON_MMUREGS, %o0)
70 SUN_PI_(lda [%o0] ASI_M_MMUREGS, %o0)
73 ENDPROC(srmmu_get_fstatus)
76 /* unsigned int srmmu_get_faddr(void) */
77 ENTRY(srmmu_get_faddr)
78 mov SRMMU_FAULT_ADDR, %o0
79 LEON_PI(lda [%o0] ASI_LEON_MMUREGS, %o0)
80 SUN_PI_(lda [%o0] ASI_M_MMUREGS, %o0)
83 ENDPROC(srmmu_get_faddr)