1 /* SPDX-License-Identifier: GPL-2.0 */ 1 /* SPDX-License-Identifier: GPL-2.0 */ 2 /* Assembler variants of srmmu access function 2 /* Assembler variants of srmmu access functions. 3 * Implemented in assembler to allow run-time 3 * Implemented in assembler to allow run-time patching. 4 * LEON uses a different ASI for MMUREGS than 4 * LEON uses a different ASI for MMUREGS than SUN. 5 * 5 * 6 * The leon_1insn_patch infrastructure is used 6 * The leon_1insn_patch infrastructure is used 7 * for the run-time patching. 7 * for the run-time patching. 8 */ 8 */ 9 9 10 #include <linux/linkage.h> 10 #include <linux/linkage.h> 11 11 12 #include <asm/asmmacro.h> 12 #include <asm/asmmacro.h> 13 #include <asm/pgtsrmmu.h> 13 #include <asm/pgtsrmmu.h> 14 #include <asm/asi.h> 14 #include <asm/asi.h> 15 15 16 /* unsigned int srmmu_get_mmureg(void) */ 16 /* unsigned int srmmu_get_mmureg(void) */ 17 ENTRY(srmmu_get_mmureg) 17 ENTRY(srmmu_get_mmureg) 18 LEON_PI(lda [%g0] ASI_LEON_MMUREGS, %o0) 18 LEON_PI(lda [%g0] ASI_LEON_MMUREGS, %o0) 19 SUN_PI_(lda [%g0] ASI_M_MMUREGS, %o0) 19 SUN_PI_(lda [%g0] ASI_M_MMUREGS, %o0) 20 retl 20 retl 21 nop 21 nop 22 ENDPROC(srmmu_get_mmureg) 22 ENDPROC(srmmu_get_mmureg) 23 23 24 /* void srmmu_set_mmureg(unsigned long regval) 24 /* void srmmu_set_mmureg(unsigned long regval) */ 25 ENTRY(srmmu_set_mmureg) 25 ENTRY(srmmu_set_mmureg) 26 LEON_PI(sta %o0, [%g0] ASI_LEON_MMUREGS) 26 LEON_PI(sta %o0, [%g0] ASI_LEON_MMUREGS) 27 SUN_PI_(sta %o0, [%g0] ASI_M_MMUREGS) 27 SUN_PI_(sta %o0, [%g0] ASI_M_MMUREGS) 28 retl 28 retl 29 nop 29 nop 30 ENDPROC(srmmu_set_mmureg) 30 ENDPROC(srmmu_set_mmureg) 31 31 32 /* void srmmu_set_ctable_ptr(unsigned long pad 32 /* void srmmu_set_ctable_ptr(unsigned long paddr) */ 33 ENTRY(srmmu_set_ctable_ptr) 33 ENTRY(srmmu_set_ctable_ptr) 34 /* paddr = ((paddr >> 4) & SRMMU_CTX_P 34 /* paddr = ((paddr >> 4) & SRMMU_CTX_PMASK); */ 35 srl %o0, 4, %g1 35 srl %o0, 4, %g1 36 and %g1, SRMMU_CTX_PMASK, %g1 36 and %g1, SRMMU_CTX_PMASK, %g1 37 37 38 mov SRMMU_CTXTBL_PTR, %g2 38 mov SRMMU_CTXTBL_PTR, %g2 39 LEON_PI(sta %g1, [%g2] ASI_LEON_MMUREGS) 39 LEON_PI(sta %g1, [%g2] ASI_LEON_MMUREGS) 40 SUN_PI_(sta %g1, [%g2] ASI_M_MMUREGS) 40 SUN_PI_(sta %g1, [%g2] ASI_M_MMUREGS) 41 retl 41 retl 42 nop 42 nop 43 ENDPROC(srmmu_set_ctable_ptr) 43 ENDPROC(srmmu_set_ctable_ptr) 44 44 45 45 46 /* void srmmu_set_context(int context) */ 46 /* void srmmu_set_context(int context) */ 47 ENTRY(srmmu_set_context) 47 ENTRY(srmmu_set_context) 48 mov SRMMU_CTX_REG, %g1 48 mov SRMMU_CTX_REG, %g1 49 LEON_PI(sta %o0, [%g1] ASI_LEON_MMUREGS) 49 LEON_PI(sta %o0, [%g1] ASI_LEON_MMUREGS) 50 SUN_PI_(sta %o0, [%g1] ASI_M_MMUREGS) 50 SUN_PI_(sta %o0, [%g1] ASI_M_MMUREGS) 51 retl 51 retl 52 nop 52 nop 53 ENDPROC(srmmu_set_context) 53 ENDPROC(srmmu_set_context) 54 54 55 55 56 /* int srmmu_get_context(void) */ 56 /* int srmmu_get_context(void) */ 57 ENTRY(srmmu_get_context) 57 ENTRY(srmmu_get_context) 58 mov SRMMU_CTX_REG, %o0 58 mov SRMMU_CTX_REG, %o0 59 LEON_PI(lda [%o0] ASI_LEON_MMUREGS, %o0) 59 LEON_PI(lda [%o0] ASI_LEON_MMUREGS, %o0) 60 SUN_PI_(lda [%o0] ASI_M_MMUREGS, %o0) 60 SUN_PI_(lda [%o0] ASI_M_MMUREGS, %o0) 61 retl 61 retl 62 nop 62 nop 63 ENDPROC(srmmu_get_context) 63 ENDPROC(srmmu_get_context) 64 64 65 65 66 /* unsigned int srmmu_get_fstatus(void) */ 66 /* unsigned int srmmu_get_fstatus(void) */ 67 ENTRY(srmmu_get_fstatus) 67 ENTRY(srmmu_get_fstatus) 68 mov SRMMU_FAULT_STATUS, %o0 68 mov SRMMU_FAULT_STATUS, %o0 69 LEON_PI(lda [%o0] ASI_LEON_MMUREGS, %o0) 69 LEON_PI(lda [%o0] ASI_LEON_MMUREGS, %o0) 70 SUN_PI_(lda [%o0] ASI_M_MMUREGS, %o0) 70 SUN_PI_(lda [%o0] ASI_M_MMUREGS, %o0) 71 retl 71 retl 72 nop 72 nop 73 ENDPROC(srmmu_get_fstatus) 73 ENDPROC(srmmu_get_fstatus) 74 74 75 75 76 /* unsigned int srmmu_get_faddr(void) */ 76 /* unsigned int srmmu_get_faddr(void) */ 77 ENTRY(srmmu_get_faddr) 77 ENTRY(srmmu_get_faddr) 78 mov SRMMU_FAULT_ADDR, %o0 78 mov SRMMU_FAULT_ADDR, %o0 79 LEON_PI(lda [%o0] ASI_LEON_MMUREGS, %o0) 79 LEON_PI(lda [%o0] ASI_LEON_MMUREGS, %o0) 80 SUN_PI_(lda [%o0] ASI_M_MMUREGS, %o0) 80 SUN_PI_(lda [%o0] ASI_M_MMUREGS, %o0) 81 retl 81 retl 82 nop 82 nop 83 ENDPROC(srmmu_get_faddr) 83 ENDPROC(srmmu_get_faddr)
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.