]> git.ozlabs.org Git - yaboot.git/blob - second/cache.S
Pegasos and partition numbering
[yaboot.git] / second / cache.S
1 /*
2  *  cache.S - PowerPC version
3  *
4  *  Copyright (C) 1995-1996 Gary Thomas (gdt@linuxppc.org)
5  *
6  *  Copyright (C) 1996 Paul Mackerras
7  *
8  *  This program is free software; you can redistribute it and/or modify
9  *  it under the terms of the GNU General Public License as published by
10  *  the Free Software Foundation; either version 2 of the License, or
11  *  (at your option) any later version.
12  *
13  *  This program is distributed in the hope that it will be useful,
14  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  *  GNU General Public License for more details.
17  *
18  *  You should have received a copy of the GNU General Public License
19  *  along with this program; if not, write to the Free Software
20  *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
21  */
22
23 #include "asm/ppc_asm.tmpl"
24 #include "asm/processor.h"
25
26 /*
27  * Write any modified data cache blocks out to memory
28  * and invalidate the corresponding instruction cache blocks.
29  * This is a no-op on the 601.
30  *
31  * flush_icache_range(unsigned long start, unsigned long stop)
32  */
33
34 CACHE_LINE_SIZE = 32
35 LG_CACHE_LINE_SIZE = 5
36
37         .text
38         .globl  flush_icache_range
39         .type   flush_icache_range,@function
40 flush_icache_range:
41         mfspr   r5,PVR
42         rlwinm  r5,r5,16,16,31
43         cmpi    0,r5,1
44         beqlr                           /* for 601, do nothing */
45         li      r5,CACHE_LINE_SIZE-1
46         andc    r3,r3,r5
47         subf    r4,r3,r4
48         add     r4,r4,r5
49         srwi.   r4,r4,LG_CACHE_LINE_SIZE
50         beqlr
51         mtctr   r4
52         mr      r6,r3
53 1:      dcbst   0,r3
54         addi    r3,r3,CACHE_LINE_SIZE
55         bdnz    1b
56         sync                            /* wait for dcbst's to get to ram */
57         mtctr   r4
58 2:      icbi    0,r6
59         addi    r6,r6,CACHE_LINE_SIZE
60         bdnz    2b
61         sync
62         isync
63         blr
64
65         .text
66         .globl  turn_off_mmu
67         .type   turn_off_mmu,@function
68 turn_off_mmu:
69         lis     r0,1f@h
70         ori     r0,r0,1f@l
71         mtspr   SRR0,r0
72         mfmsr   r0
73         lis     r2,(~(MSR_DR|MSR_IR))@h
74         ori     r2,r2,(~(MSR_DR|MSR_IR))@l
75         and     r0,r0,r2
76         mtspr   SRR1,r0
77         rfi
78 1:
79         blr