OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [orpsocv2/] [sw/] [drivers/] [or1200/] [cache.S] - Blame information for rev 624

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 530 julius
#include "spr-defs.h"
2
        /* Cache init. To be called during init ONLY */
3
 
4
        .global _cache_init
5
        .type   _cache_init,@function
6
 
7
_cache_init:
8
        /* Instruction cache enable */
9
        /* Check if IC present and skip enabling otherwise */
10
        l.mfspr r3,r0,SPR_UPR
11
        l.andi  r4,r3,SPR_UPR_ICP
12
        l.sfeq  r4,r0
13
        l.bf    .L8
14
        l.nop
15
 
16
        /* Disable IC */
17
        l.mfspr r6,r0,SPR_SR
18
        l.addi  r5,r0,-1
19
        l.xori  r5,r5,SPR_SR_ICE
20
        l.and   r5,r6,r5
21
        l.mtspr r0,r5,SPR_SR
22
 
23
        /* Establish cache block size
24
        If BS=0, 16;
25
        If BS=1, 32;
26
        r14 contain block size
27
        */
28
        l.mfspr r3,r0,SPR_ICCFGR
29
        l.andi  r4,r3,SPR_ICCFGR_CBS
30
        l.srli  r5,r4,7
31
        l.ori   r6,r0,16
32
        l.sll   r14,r6,r5
33
 
34
        /* Establish number of cache sets
35
        r7 contains number of cache sets
36
        r5 contains log(# of cache sets)
37
        */
38
        l.andi  r4,r3,SPR_ICCFGR_NCS
39
        l.srli  r5,r4,3
40
        l.ori   r6,r0,1
41
        l.sll   r7,r6,r5
42
 
43
        /* Invalidate IC */
44
        l.addi  r6,r0,0
45
        l.sll   r5,r14,r5
46
 
47
.L7:
48
        l.mtspr r0,r6,SPR_ICBIR
49
        l.sfne  r6,r5
50
        l.bf    .L7
51
        l.add   r6,r6,r14
52
 
53
        /* Enable IC */
54
        l.mfspr r6,r0,SPR_SR
55
        l.ori   r6,r6,SPR_SR_ICE
56
        l.mtspr r0,r6,SPR_SR
57
        l.nop
58
        l.nop
59
        l.nop
60
        l.nop
61
        l.nop
62
        l.nop
63
        l.nop
64
        l.nop
65
 
66
.L8:
67
        /* Data cache enable */
68
        /* Check if DC present and skip enabling otherwise */
69
        l.mfspr r3,r0,SPR_UPR
70
        l.andi  r4,r3,SPR_UPR_DCP
71
        l.sfeq  r4,r0
72
        l.bf    .L10
73
        l.nop
74
        /* Disable DC */
75
        l.mfspr r6,r0,SPR_SR
76
        l.addi  r5,r0,-1
77
        l.xori  r5,r5,SPR_SR_DCE
78
        l.and   r5,r6,r5
79
        l.mtspr r0,r5,SPR_SR
80
        /* Establish cache block size
81
           If BS=0, 16;
82
           If BS=1, 32;
83
           r14 contain block size
84
        */
85
        l.mfspr r3,r0,SPR_DCCFGR
86
        l.andi  r4,r3,SPR_DCCFGR_CBS
87
        l.srli  r5,r4,7
88
        l.ori   r6,r0,16
89
        l.sll   r14,r6,r5
90
        /* Establish number of cache sets
91
           r7 contains number of cache sets
92
           r5 contains log(# of cache sets)
93
        */
94
        l.andi  r4,r3,SPR_DCCFGR_NCS
95
        l.srli  r5,r4,3
96
        l.ori   r6,r0,1
97
        l.sll   r7,r6,r5
98
        /* Invalidate DC */
99
        l.addi  r6,r0,0
100
        l.sll   r5,r14,r5
101
.L9:
102
        l.mtspr r0,r6,SPR_DCBIR
103
        l.sfne  r6,r5
104
        l.bf    .L9
105
        l.add   r6,r6,r14
106
        /* Enable DC */
107
        l.mfspr r6,r0,SPR_SR
108
        l.ori   r6,r6,SPR_SR_DCE
109
        l.mtspr r0,r6,SPR_SR
110
 
111
.L10:
112
        /* Return */
113
        l.jr    r9
114
        l.nop

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.