^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) * Miscellaneous low-level MMU functions.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) * Copyright (C) 2008-2009 Michal Simek <monstr@monstr.eu>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) * Copyright (C) 2008-2009 PetaLogix
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) * Copyright (C) 2007 Xilinx, Inc. All rights reserved.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) * Derived from arch/ppc/kernel/misc.S
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) * This file is subject to the terms and conditions of the GNU General
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) * Public License. See the file COPYING in the main directory of this
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) * archive for more details.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) #include <linux/linkage.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) #include <linux/sys.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) #include <asm/unistd.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) #include <linux/errno.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) #include <asm/mmu.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) #include <asm/page.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) .text
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) * Flush MMU TLB
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) * We avoid flushing the pinned 0, 1 and possibly 2 entries.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) .globl _tlbia;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) .type _tlbia, @function
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) .align 4;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) _tlbia:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) lwi r12, r0, tlb_skip;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) /* isync */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) _tlbia_1:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) mts rtlbx, r12
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) nop
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) mts rtlbhi, r0 /* flush: ensure V is clear */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) nop
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) rsubi r11, r12, MICROBLAZE_TLB_SIZE - 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) bneid r11, _tlbia_1 /* loop for all entries */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) addik r12, r12, 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) mbar 1 /* sync */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) rtsd r15, 8
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) nop
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) .size _tlbia, . - _tlbia
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) * Flush MMU TLB for a particular address (in r5)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) .globl _tlbie;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) .type _tlbie, @function
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) .align 4;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) _tlbie:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) mts rtlbsx, r5 /* look up the address in TLB */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) nop
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) mfs r12, rtlbx /* Retrieve index */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) nop
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) blti r12, _tlbie_1 /* Check if found */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) mts rtlbhi, r0 /* flush: ensure V is clear */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) nop
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) mbar 1 /* sync */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) _tlbie_1:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) rtsd r15, 8
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) nop
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) .size _tlbie, . - _tlbie