2 * Copyright (C) 2002 Wolfgang Denk <wd@denx.de>
4 * See file CREDITS for list of people who contributed to this
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License as
9 * published by the Free Software Foundation; either version 2 of
10 * the License, or (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
25 #if defined(CONFIG_MPC823) || \
26 defined(CONFIG_MPC850) || \
27 defined(CONFIG_MPC855) || \
28 defined(CONFIG_MPC860) || \
29 defined(CONFIG_MPC862)
32 #include <ppc_asm.tmpl>
34 #include <asm/cache.h>
36 #if CONFIG_POST & CONFIG_SYS_POST_CACHE
40 cache_post_dinvalidate:
45 cache_post_iinvalidate:
52 lis r10, IDC_DISABLE@h
71 lis r10, IDC_DISABLE@h
96 * turn on the data cache
97 * switch the data cache to write-back or write-through mode
98 * invalidate the data cache
99 * write the negative pattern to a cached area
102 * The negative pattern must be read at the last step
104 .global cache_post_test1
113 bl cache_post_dinvalidate
115 /* Write the negative pattern to the test area */
125 /* Read the test area */
141 bl cache_post_ddisable
142 bl cache_post_dinvalidate
151 * turn on the data cache
152 * switch the data cache to write-back or write-through mode
153 * invalidate the data cache
154 * write the zero pattern to a cached area
155 * turn off the data cache
156 * write the negative pattern to the area
157 * turn on the data cache
160 * The negative pattern must be read at the last step
162 .global cache_post_test2
171 bl cache_post_dinvalidate
173 /* Write the zero pattern to the test area */
183 bl cache_post_ddisable
185 /* Write the negative pattern to the test area */
197 /* Read the test area */
213 bl cache_post_ddisable
214 bl cache_post_dinvalidate
223 * turn on the data cache
224 * switch the data cache to write-through mode
225 * invalidate the data cache
226 * write the zero pattern to a cached area
227 * flush the data cache
228 * write the negative pattern to the area
229 * turn off the data cache
232 * The negative pattern must be read at the last step
234 .global cache_post_test3
242 bl cache_post_ddisable
243 bl cache_post_dinvalidate
245 /* Write the zero pattern to the test area */
256 bl cache_post_dinvalidate
258 /* Write the negative pattern to the test area */
268 bl cache_post_ddisable
269 bl cache_post_dinvalidate
271 /* Read the test area */
294 * turn on the data cache
295 * switch the data cache to write-back mode
296 * invalidate the data cache
297 * write the negative pattern to a cached area
298 * flush the data cache
299 * write the zero pattern to the area
300 * invalidate the data cache
303 * The negative pattern must be read at the last step
305 .global cache_post_test4
313 bl cache_post_ddisable
314 bl cache_post_dinvalidate
316 /* Write the negative pattern to the test area */
327 bl cache_post_dinvalidate
329 /* Write the zero pattern to the test area */
339 bl cache_post_ddisable
340 bl cache_post_dinvalidate
342 /* Read the test area */
370 * turn on the instruction cache
371 * unlock the entire instruction cache
372 * invalidate the instruction cache
373 * lock a branch instruction in the instruction cache
374 * replace the branch instruction with "nop"
375 * jump to the branch instruction
376 * check that the branch instruction was executed
378 .global cache_post_test5
383 bl cache_post_ienable
384 bl cache_post_iunlock
385 bl cache_post_iinvalidate
387 /* Compute r9 = cache_post_test5_reloc */
388 bl cache_post_test5_reloc
389 cache_post_test5_reloc:
392 /* Copy the test instruction to cache_post_test5_data */
393 lis r3, (cache_post_test5_1 - cache_post_test5_reloc)@h
394 ori r3, r3, (cache_post_test5_1 - cache_post_test5_reloc)@l
396 lis r4, (cache_post_test5_data - cache_post_test5_reloc)@h
397 ori r4, r4, (cache_post_test5_data - cache_post_test5_reloc)@l
402 bl cache_post_iinvalidate
404 /* Lock the branch instruction */
405 lis r3, (cache_post_test5_data - cache_post_test5_reloc)@h
406 ori r3, r3, (cache_post_test5_data - cache_post_test5_reloc)@l
410 /* Replace the test instruction */
411 lis r3, (cache_post_test5_2 - cache_post_test5_reloc)@h
412 ori r3, r3, (cache_post_test5_2 - cache_post_test5_reloc)@l
414 lis r4, (cache_post_test5_data - cache_post_test5_reloc)@h
415 ori r4, r4, (cache_post_test5_data - cache_post_test5_reloc)@l
420 bl cache_post_iinvalidate
422 /* Execute to the test instruction */
423 cache_post_test5_data:
426 bl cache_post_iunlock
438 * turn on the instruction cache
439 * unlock the entire instruction cache
440 * invalidate the instruction cache
441 * lock a branch instruction in the instruction cache
442 * replace the branch instruction with "nop"
443 * jump to the branch instruction
444 * check that the branch instruction was executed
446 .global cache_post_test6
451 bl cache_post_ienable
452 bl cache_post_iunlock
453 bl cache_post_iinvalidate
455 /* Compute r9 = cache_post_test6_reloc */
456 bl cache_post_test6_reloc
457 cache_post_test6_reloc:
460 /* Copy the test instruction to cache_post_test6_data */
461 lis r3, (cache_post_test6_1 - cache_post_test6_reloc)@h
462 ori r3, r3, (cache_post_test6_1 - cache_post_test6_reloc)@l
464 lis r4, (cache_post_test6_data - cache_post_test6_reloc)@h
465 ori r4, r4, (cache_post_test6_data - cache_post_test6_reloc)@l
470 bl cache_post_iinvalidate
472 /* Replace the test instruction */
473 lis r3, (cache_post_test6_2 - cache_post_test6_reloc)@h
474 ori r3, r3, (cache_post_test6_2 - cache_post_test6_reloc)@l
476 lis r4, (cache_post_test6_data - cache_post_test6_reloc)@h
477 ori r4, r4, (cache_post_test6_data - cache_post_test6_reloc)@l
482 bl cache_post_iinvalidate
484 /* Execute to the test instruction */
485 cache_post_test6_data:
492 #endif /* CONFIG_MPC823 || MPC850 || MPC855 || MPC860 */
493 #endif /* CONFIG_POST & CONFIG_SYS_POST_CACHE */