Cache
Freescale Semiconductor
6-19
6.4.6
Cache Management
The cache can be enabled and configured by using a MOVEC instruction to access CACR. A hardware
reset clears CACR, disabling the cache and removing all configuration information; however, reset does
not affect the tags, state information, and data in the cache.
Set CACR[DCINVA,ICINVA] to invalidate the caches before enabling them.
The privileged CPUSHL instruction supports cache management by selectively pushing and invalidating
cache lines. The address register used with CPUSHL directly addresses the cache’s directory array. The
CPUSHL instruction flushes a cache line.
The value of CACR[DDPI,IDPI] determines whether CPUSHL invalidates a cache line after it is pushed.
To push the entire cache, implement a software loop to index through all sets and each of the four lines
within each set
(for a total of 512 lines for the data cache and 1024 lines for the instruction cache). The
state of CACR[DEC,IEC] does not affect the operation of CPUSHL or CACR[DCINVA,ICINVA].
Disabling a cache by clearing CACR[IEC] or CACR[DEC] makes the cache non-operational without
affecting tags, state information, or contents.
The contents of A
x
used with CPUSHL specify cache row and line indexes. This differs from the
MC68040 family where a physical address is specified.
x
format for the data and
instruction cache.
The following code example flushes the entire
data cache:
_cache_disable:
nop
move.w
#0x2700,SR
;mask off IRQs
jsr
_cache_flush
;flush the cache completely
clr.l
d0
movec
d0,ACR0
;ACR0 off
movec
d0,ACR1
;ACR1 off
move.l
#0x01000000,d0
;Invalidate and disable cache
movec
d0,CACR
rts
_cache_flush:
nop
;synchronize—flush store buffer
moveq.l
#0,d0
;initialize way counter
moveq.l
#0,d1
;initialize set counter
move.l
d0,a0
;initialize cpushl pointer
setloop:
cpushl
dc,(a0)
;push cache line a0
add.l
#0x0010,a0
;increment set index by 1
addq.l
#1,d1
;increment set counter
cmpi.l
#255,d1
;are sets for this way done?
bne
setloop
moveq.l
#0,d1
;set counter to zero again
addq.l
#1,d0
;increment to next way
move.l
d0,a0
;set = 0, way = d0
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
9
8
7
6
5
4
3
2
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
Set Index
Way Index
Figure 6-9. A
x
Format
Summary of Contents for MCF54455
Page 33: ...xxviii Freescale Semiconductor ...
Page 67: ...Freescale Semiconductor 1 ...
Page 125: ...Freescale Semiconductor 1 ...
Page 145: ...Enhanced Multiply Accumulate Unit EMAC 5 21 Freescale Semiconductor ...
Page 173: ...Cache 6 28 Freescale Semiconductor ...
Page 179: ...Static RAM SRAM 7 6 Freescale Semiconductor ...
Page 207: ...Power Management 9 16 Freescale Semiconductor ...
Page 323: ...Reset Controller Module 13 8 Freescale Semiconductor ...
Page 389: ...Pin Multiplexing and Control 16 44 Freescale Semiconductor ...
Page 575: ...PCI Bus Controller 22 58 Freescale Semiconductor ...
Page 600: ...Advanced Technology Attachment ATA Freescale Semiconductor 23 25 ...
Page 601: ...Freescale Semiconductor 1 ...
Page 842: ...I2 C Interface Freescale Semiconductor 33 16 ...
Page 843: ...Freescale Semiconductor 1 ...
Page 921: ...Revision History A 6 Freescale Semiconductor ...