/*1* Miscellaneous low-level MMU functions.2*3* Copyright (C) 2008-2009 Michal Simek <[email protected]>4* Copyright (C) 2008-2009 PetaLogix5* Copyright (C) 2007 Xilinx, Inc. All rights reserved.6*7* Derived from arch/ppc/kernel/misc.S8*9* This file is subject to the terms and conditions of the GNU General10* Public License. See the file COPYING in the main directory of this11* archive for more details.12*/1314#include <linux/linkage.h>15#include <linux/sys.h>16#include <asm/unistd.h>17#include <linux/errno.h>18#include <asm/mmu.h>19#include <asm/page.h>2021.text22/*23* Flush MMU TLB24*25* We avoid flushing the pinned 0, 1 and possibly 2 entries.26*/27.globl _tlbia;28.type _tlbia, @function29.align 4;30_tlbia:31addik r12, r0, MICROBLAZE_TLB_SIZE - 1 /* flush all entries (63 - 3) */32/* isync */33_tlbia_1:34mts rtlbx, r1235nop36mts rtlbhi, r0 /* flush: ensure V is clear */37nop38addik r11, r12, -239bneid r11, _tlbia_1 /* loop for all entries */40addik r12, r12, -141/* sync */42rtsd r15, 843nop44.size _tlbia, . - _tlbia4546/*47* Flush MMU TLB for a particular address (in r5)48*/49.globl _tlbie;50.type _tlbie, @function51.align 4;52_tlbie:53mts rtlbsx, r5 /* look up the address in TLB */54nop55mfs r12, rtlbx /* Retrieve index */56nop57blti r12, _tlbie_1 /* Check if found */58mts rtlbhi, r0 /* flush: ensure V is clear */59nop60_tlbie_1:61rtsd r15, 862nop6364.size _tlbie, . - _tlbie6566/*67* Allocate TLB entry for early console68*/69.globl early_console_reg_tlb_alloc;70.type early_console_reg_tlb_alloc, @function71.align 4;72early_console_reg_tlb_alloc:73/*74* Load a TLB entry for the UART, so that microblaze_progress() can use75* the UARTs nice and early. We use a 4k real==virtual mapping.76*/77ori r4, r0, MICROBLAZE_TLB_SIZE - 178mts rtlbx, r4 /* TLB slot 63 */7980or r4,r5,r081andi r4,r4,0xfffff00082ori r4,r4,(TLB_WR|TLB_I|TLB_M|TLB_G)8384andi r5,r5,0xfffff00085ori r5,r5,(TLB_VALID | TLB_PAGESZ(PAGESZ_4K))8687mts rtlblo,r4 /* Load the data portion of the entry */88nop89mts rtlbhi,r5 /* Load the tag portion of the entry */90nop91rtsd r15, 892nop9394.size early_console_reg_tlb_alloc, . - early_console_reg_tlb_alloc959697