]> git.ozlabs.org Git - yaboot.git/blob - second/cache.S
Commit yaboot 1.3.3
[yaboot.git] / second / cache.S
1 /*
2  *  PowerPC version 
3  *    Copyright (C) 1995-1996 Gary Thomas (gdt@linuxppc.org)
4  *    Copyright (C) 1996 Paul Mackerras.
5  *
6  *  This program is free software; you can redistribute it and/or
7  *  modify it under the terms of the GNU General Public License
8  *  as published by the Free Software Foundation; either version
9  *  2 of the License, or (at your option) any later version.
10  */
11         
12 #include "asm/ppc_asm.tmpl"
13 #include "asm/processor.h"
14         
15 /*
16  * Write any modified data cache blocks out to memory
17  * and invalidate the corresponding instruction cache blocks.
18  * This is a no-op on the 601.
19  *
20  * flush_icache_range(unsigned long start, unsigned long stop)
21  */
22
23 CACHE_LINE_SIZE = 32
24 LG_CACHE_LINE_SIZE = 5
25
26         .text
27         .globl  flush_icache_range
28         .type   flush_icache_range,@function
29 flush_icache_range:
30         mfspr   r5,PVR
31         rlwinm  r5,r5,16,16,31
32         cmpi    0,r5,1
33         beqlr                           /* for 601, do nothing */
34         li      r5,CACHE_LINE_SIZE-1
35         andc    r3,r3,r5
36         subf    r4,r3,r4
37         add     r4,r4,r5
38         srwi.   r4,r4,LG_CACHE_LINE_SIZE
39         beqlr
40         mtctr   r4
41         mr      r6,r3
42 1:      dcbst   0,r3
43         addi    r3,r3,CACHE_LINE_SIZE
44         bdnz    1b
45         sync                            /* wait for dcbst's to get to ram */
46         mtctr   r4
47 2:      icbi    0,r6
48         addi    r6,r6,CACHE_LINE_SIZE
49         bdnz    2b
50         sync
51         isync
52         blr
53
54         .text
55         .globl  turn_off_mmu
56         .type   turn_off_mmu,@function
57 turn_off_mmu:
58         lis     r0,1f@h
59         ori     r0,r0,1f@l
60         mtspr   SRR0,r0
61         mfmsr   r0
62         lis     r2,(~(MSR_DR|MSR_IR))@h
63         ori     r2,r2,(~(MSR_DR|MSR_IR))@l
64         and     r0,r0,r2
65         mtspr   SRR1,r0
66         rfi
67 1:
68         blr