1 /* SPDX-License-Identifier: GPL-2.0-only */
3 * linux/arch/unicore32/mm/proc-ucv2.S
5 * Code specific to PKUnity SoC and UniCore ISA
7 * Copyright (C) 2001-2010 GUAN Xue-tao
9 #include <linux/init.h>
10 #include <linux/linkage.h>
11 #include <asm/assembler.h>
12 #include <asm/hwcap.h>
13 #include <asm/pgtable-hwdef.h>
14 #include <asm/pgtable.h>
16 #include "proc-macros.S"
20 mov ip, #PSR_R_BIT | PSR_I_BIT | PRIV_MODE
22 b.l __cpuc_flush_kern_all
28 * Perform a soft reset of the system. Put the CPU into the
29 * same state as it would be if it had been reset, and branch
30 * to what would be the reset vector.
32 * - loc - location to jump to for soft reset
37 movc p0.c5, ip, #28 @ Cache invalidate all
40 movc p0.c6, ip, #6 @ TLB invalidate all
43 movc ip, p0.c1, #0 @ ctrl register
44 or ip, ip, #0x2000 @ vector base address
45 andn ip, ip, #0x000f @ ............idam
46 movc p0.c1, ip, #0 @ disable caches and mmu
48 mov pc, r0 @ jump to loc
54 * Idle the processor (eg, wait for interrupt).
56 * IRQs are already disabled.
59 mov r0, #0 @ PCI address
65 ENTRY(cpu_dcache_clean_area)
66 #ifndef CONFIG_CPU_DCACHE_LINE_DISABLE
67 csub.a r1, #MAX_AREA_SIZE
70 sub r9, r9, #1 @ PAGE_MASK
71 1: va2pa r0, r10, r11, r12, r13 @ r10 is PA
75 3: movc p0.c5, r10, #11 @ clean D entry
77 add r0, r0, #CACHE_LINESIZE
78 add r10, r10, #CACHE_LINESIZE
79 sub.a r1, r1, #CACHE_LINESIZE
84 movc p0.c5, ip, #10 @ Dcache clean all
90 * cpu_do_switch_mm(pgd_phys)
92 * Set the translation table base pointer to be pgd_phys
94 * - pgd_phys - physical address of new pgd
97 * - we are not using split page tables
100 ENTRY(cpu_do_switch_mm)
101 movc p0.c2, r0, #0 @ update page table ptr
104 movc p0.c6, ip, #6 @ TLB invalidate all
110 * cpu_set_pte(ptep, pte)
112 * Set a level 2 translation table entry.
114 * - ptep - pointer to level 2 translation table entry
115 * - pte - PTE value to store
120 #ifndef CONFIG_CPU_DCACHE_LINE_DISABLE
121 sub r2, r0, #PAGE_OFFSET
122 movc p0.c5, r2, #11 @ Dcache clean line
126 movc p0.c5, ip, #10 @ Dcache clean all
128 @dcacheline_flush r0, r2, ip