
4-34
G2 PowerPC Core Reference Manual
For More Information On This Product,
Go to: www.freescale.com
MOTOROLA
Cache Locking
Disabling exceptions
Loading the cache
Locking the cache (entire cache locking or cache way-locking)
In addition, this section describes how to invalidate the data and instruction caches, even
when they are locked.
4.12.3.1 Data Cache Locking
This section describes the procedures for performing data cache locking on the G2 core.
4.12.3.1.1 Enabling the Data Cache
To lock the data cache, the data cache enable bit HID0[DCE], bit 17, must be set. The
following assembly code enables the data cache:
# Enable the data cache. This corresponds
# to setting DCE bit in HID0 (bit 17)
mfspr
ori
sync
mtspr
r1, HID0
r1, r1, 0x4000
HID0, r1
4.12.3.1.2 Address Translation for Data 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 data to be locked resides
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, the 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. 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 data to lock. Both memory areas use
identity translation (the logical memory address equals the physical memory address).
Table 4-13 summarizes the BAT settings used in this example.
F
Freescale Semiconductor, Inc.
n
.