2 * Miscellaneous low-level MMU functions.
4 * Copyright (C) 2008-2009 Michal Simek <monstr@monstr.eu>
5 * Copyright (C) 2008-2009 PetaLogix
6 * Copyright (C) 2007 Xilinx, Inc. All rights reserved.
8 * Derived from arch/ppc/kernel/misc.S
10 * This file is subject to the terms and conditions of the GNU General
11 * Public License. See the file COPYING in the main directory of this
12 * archive for more details.
15 #include <linux/linkage.h>
16 #include <linux/sys.h>
17 #include <asm/unistd.h>
18 #include <linux/errno.h>
26 * We avoid flushing the pinned 0, 1 and possibly 2 entries.
31 addik r12, r0, 63 /* flush all entries (63 - 3) */
36 mts rtlbhi, r0 /* flush: ensure V is clear */
39 bneid r11, _tlbia_1 /* loop for all entries */
46 * Flush MMU TLB for a particular address (in r5)
51 mts rtlbsx, r5 /* look up the address in TLB */
53 mfs r12, rtlbx /* Retrieve index */
55 blti r12, _tlbie_1 /* Check if found */
56 mts rtlbhi, r0 /* flush: ensure V is clear */
63 * Allocate TLB entry for early console
65 .globl early_console_reg_tlb_alloc;
67 early_console_reg_tlb_alloc:
69 * Load a TLB entry for the UART, so that microblaze_progress() can use
70 * the UARTs nice and early. We use a 4k real==virtual mapping.
73 mts rtlbx, r4 /* TLB slot 2 */
77 ori r4,r4,(TLB_WR|TLB_I|TLB_M|TLB_G)
80 ori r5,r5,(TLB_VALID | TLB_PAGESZ(PAGESZ_4K))
82 mts rtlblo,r4 /* Load the data portion of the entry */
84 mts rtlbhi,r5 /* Load the tag portion of the entry */
90 * Copy a whole page (4096 bytes).
92 #define COPY_16_BYTES \
103 /* FIXME DCACHE_LINE_BYTES (CONFIG_XILINX_MICROBLAZE0_DCACHE_LINE_LEN * 4)*/
104 #define DCACHE_LINE_BYTES (4 * 4)
109 ori r11, r0, (PAGE_SIZE/DCACHE_LINE_BYTES) - 1
112 #if DCACHE_LINE_BYTES >= 32
115 addik r6, r6, DCACHE_LINE_BYTES
116 addik r5, r5, DCACHE_LINE_BYTES
117 bneid r11, _copy_page_loop