
MOTOROLA
Chapter 4. Instruction and Data Cache Operation
For More Information On This Product,
Go to: www.freescale.com
4-39
Cache Locking
# Enable the data cache. This corresponds
# to setting DCE bit in HID0 (bit 17)
mfspr
ori
sync
mtspr
r1, HID0
r1, r1, 0x8000
HID0, r1
4.12.3.2.2 Address Translation for Instruction Cache Locking
Two distinct memory areas must be set up to enable cache locking:
The first area is where the code that performs the locking resides and is executed
from
The second area is where the instructions to be locked reside
Both areas of memory must be in locations that are translated by the memory management
unit (MMU). This translation can be performed either with the page table or the block
address translation (BAT) registers.
For the purposes of the cache locking example in this document, two areas of memory are
defined using the BAT registers. The first area is a 1-Mbyte area in the upper region of
memory that contains the code performing the cache locking. This area of memory must be
cache-inhibited for instruction cache locking. The second area is a 256-Mbyte block of
memory (not all of the 256 Mbytes of memory is locked in the cache; this area is set up as
an example) that contains the instructions to lock. Both memory areas use identity
translation (the logical memory address equals the physical memory address). Table 4-16
summarizes the BAT settings used in this example.
The block address translation upper (BATU) and block address translation lower (BATL)
settings in Table 4-16 can be used for both instruction block address translation (IBAT) and
data block address translation (DBAT) registers. After the BAT registers have been set up,
the MMU must be enabled.
The following assembly code enables both instruction and data memory address
translation:
# Enable instruction and data memory address translation. This
# corresponds to setting IR and DR in the MSR (bits 26 & 27)
Table 4-16. Example BAT Settings for Cache Locking
Area
Base Address
Memory Size
WIMG Bits
BATU Setting
BATL Setting
First
0xFFF0_0000
1 Mbyte
0b0100
1
0xFFF0_001F
0xFFF0_0022
1
1
0xFFF0_0022 defines a cache-inhibited memory area used for instruction cache locking, and corresponds
to a WIMG of 0b0100. Cache-inhibited memory is not a requirement for data cache locking. A setting of
0xFFF0_0002 with a corresponding WIMG of 0b0000 marks the memory area as cacheable.
Second
0x0000_0000
256 Mbytes
0b0000
0x0000_1FFF
0x0000_0002
F
Freescale Semiconductor, Inc.
n
.