/*1* linux/arch/unicore32/mm/proc-ucv2.S2*3* Code specific to PKUnity SoC and UniCore ISA4*5* Copyright (C) 2001-2010 GUAN Xue-tao6*7* This program is free software; you can redistribute it and/or modify8* it under the terms of the GNU General Public License version 2 as9* published by the Free Software Foundation.10*/11#include <linux/init.h>12#include <linux/linkage.h>13#include <asm/assembler.h>14#include <asm/hwcap.h>15#include <asm/pgtable-hwdef.h>16#include <asm/pgtable.h>1718#include "proc-macros.S"1920ENTRY(cpu_proc_fin)21stm.w (lr), [sp-]22mov ip, #PSR_R_BIT | PSR_I_BIT | PRIV_MODE23mov.a asr, ip24b.l __cpuc_flush_kern_all25ldm.w (pc), [sp]+2627/*28* cpu_reset(loc)29*30* Perform a soft reset of the system. Put the CPU into the31* same state as it would be if it had been reset, and branch32* to what would be the reset vector.33*34* - loc - location to jump to for soft reset35*/36.align 537ENTRY(cpu_reset)38mov ip, #039movc p0.c5, ip, #28 @ Cache invalidate all40nop84142movc p0.c6, ip, #6 @ TLB invalidate all43nop84445movc ip, p0.c1, #0 @ ctrl register46or ip, ip, #0x2000 @ vector base address47andn ip, ip, #0x000f @ ............idam48movc p0.c1, ip, #0 @ disable caches and mmu49nop50mov pc, r0 @ jump to loc51nop85253/*54* cpu_do_idle()55*56* Idle the processor (eg, wait for interrupt).57*58* IRQs are already disabled.59*/60ENTRY(cpu_do_idle)61mov r0, #0 @ PCI address62.rept 863ldw r1, [r0]64.endr65mov pc, lr6667ENTRY(cpu_dcache_clean_area)68#ifndef CONFIG_CPU_DCACHE_LINE_DISABLE69csub.a r1, #MAX_AREA_SIZE70bsg 101f71mov r9, #PAGE_SZ72sub r9, r9, #1 @ PAGE_MASK731: va2pa r0, r10, r11, r12, r13 @ r10 is PA74b 3f752: cand.a r0, r976beq 1b773: movc p0.c5, r10, #11 @ clean D entry78nop879add r0, r0, #CACHE_LINESIZE80add r10, r10, #CACHE_LINESIZE81sub.a r1, r1, #CACHE_LINESIZE82bua 2b83mov pc, lr84#endif85101: mov ip, #086movc p0.c5, ip, #10 @ Dcache clean all87nop88889mov pc, lr9091/*92* cpu_do_switch_mm(pgd_phys)93*94* Set the translation table base pointer to be pgd_phys95*96* - pgd_phys - physical address of new pgd97*98* It is assumed that:99* - we are not using split page tables100*/101.align 5102ENTRY(cpu_do_switch_mm)103movc p0.c2, r0, #0 @ update page table ptr104nop8105106movc p0.c6, ip, #6 @ TLB invalidate all107nop8108109mov pc, lr110111/*112* cpu_set_pte(ptep, pte)113*114* Set a level 2 translation table entry.115*116* - ptep - pointer to level 2 translation table entry117* - pte - PTE value to store118*/119.align 5120ENTRY(cpu_set_pte)121stw r1, [r0]122#ifndef CONFIG_CPU_DCACHE_LINE_DISABLE123sub r2, r0, #PAGE_OFFSET124movc p0.c5, r2, #11 @ Dcache clean line125nop8126#else127mov ip, #0128movc p0.c5, ip, #10 @ Dcache clean all129nop8130@dcacheline_flush r0, r2, ip131#endif132mov pc, lr133134135136