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