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,
26 #if defined(CONFIG_MPC823) || \
27 defined(CONFIG_MPC850) || \
28 defined(CONFIG_MPC855) || \
29 defined(CONFIG_MPC860) || \
30 defined(CONFIG_MPC862) || \
31 defined(CONFIG_MPC824X)
34 #include <ppc_asm.tmpl>
36 #include <asm/cache.h>
38 #if CONFIG_POST & CFG_POST_CACHE
42 cache_post_dinvalidate:
47 cache_post_iinvalidate:
54 lis r10, IDC_DISABLE@h
73 lis r10, IDC_DISABLE@h
98 * turn on the data cache
99 * switch the data cache to write-back or write-through mode
100 * invalidate the data cache
101 * write the negative pattern to a cached area
104 * The negative pattern must be read at the last step
106 .global cache_post_test1
115 bl cache_post_dinvalidate
117 /* Write the negative pattern to the test area */
127 /* Read the test area */
143 bl cache_post_ddisable
144 bl cache_post_dinvalidate
153 * turn on the data cache
154 * switch the data cache to write-back or write-through mode
155 * invalidate the data cache
156 * write the zero pattern to a cached area
157 * turn off the data cache
158 * write the negative pattern to the area
159 * turn on the data cache
162 * The negative pattern must be read at the last step
164 .global cache_post_test2
173 bl cache_post_dinvalidate
175 /* Write the zero pattern to the test area */
185 bl cache_post_ddisable
187 /* Write the negative pattern to the test area */
199 /* Read the test area */
215 bl cache_post_ddisable
216 bl cache_post_dinvalidate
225 * turn on the data cache
226 * switch the data cache to write-through mode
227 * invalidate the data cache
228 * write the zero pattern to a cached area
229 * flush the data cache
230 * write the negative pattern to the area
231 * turn off the data cache
234 * The negative pattern must be read at the last step
236 .global cache_post_test3
244 bl cache_post_ddisable
245 bl cache_post_dinvalidate
247 /* Write the zero pattern to the test area */
258 bl cache_post_dinvalidate
260 /* Write the negative pattern to the test area */
270 bl cache_post_ddisable
271 bl cache_post_dinvalidate
273 /* Read the test area */
296 * turn on the data cache
297 * switch the data cache to write-back mode
298 * invalidate the data cache
299 * write the negative pattern to a cached area
300 * flush the data cache
301 * write the zero pattern to the area
302 * invalidate the data cache
305 * The negative pattern must be read at the last step
307 .global cache_post_test4
315 bl cache_post_ddisable
316 bl cache_post_dinvalidate
318 /* Write the negative pattern to the test area */
329 bl cache_post_dinvalidate
331 /* Write the zero pattern to the test area */
341 bl cache_post_ddisable
342 bl cache_post_dinvalidate
344 /* Read the test area */
372 * turn on the instruction cache
373 * unlock the entire instruction cache
374 * invalidate the instruction cache
375 * lock a branch instruction in the instruction cache
376 * replace the branch instruction with "nop"
377 * jump to the branch instruction
378 * check that the branch instruction was executed
380 .global cache_post_test5
385 bl cache_post_ienable
386 bl cache_post_iunlock
387 bl cache_post_iinvalidate
389 /* Compute r9 = cache_post_test5_reloc */
390 bl cache_post_test5_reloc
391 cache_post_test5_reloc:
394 /* Copy the test instruction to cache_post_test5_data */
395 lis r3, (cache_post_test5_1 - cache_post_test5_reloc)@h
396 ori r3, r3, (cache_post_test5_1 - cache_post_test5_reloc)@l
398 lis r4, (cache_post_test5_data - cache_post_test5_reloc)@h
399 ori r4, r4, (cache_post_test5_data - cache_post_test5_reloc)@l
404 bl cache_post_iinvalidate
406 /* Lock the branch instruction */
407 lis r3, (cache_post_test5_data - cache_post_test5_reloc)@h
408 ori r3, r3, (cache_post_test5_data - cache_post_test5_reloc)@l
412 /* Replace the test instruction */
413 lis r3, (cache_post_test5_2 - cache_post_test5_reloc)@h
414 ori r3, r3, (cache_post_test5_2 - cache_post_test5_reloc)@l
416 lis r4, (cache_post_test5_data - cache_post_test5_reloc)@h
417 ori r4, r4, (cache_post_test5_data - cache_post_test5_reloc)@l
422 bl cache_post_iinvalidate
424 /* Execute to the test instruction */
425 cache_post_test5_data:
428 bl cache_post_iunlock
440 * turn on the instruction cache
441 * unlock the entire instruction cache
442 * invalidate the instruction cache
443 * lock a branch instruction in the instruction cache
444 * replace the branch instruction with "nop"
445 * jump to the branch instruction
446 * check that the branch instruction was executed
448 .global cache_post_test6
453 bl cache_post_ienable
454 bl cache_post_iunlock
455 bl cache_post_iinvalidate
457 /* Compute r9 = cache_post_test6_reloc */
458 bl cache_post_test6_reloc
459 cache_post_test6_reloc:
462 /* Copy the test instruction to cache_post_test6_data */
463 lis r3, (cache_post_test6_1 - cache_post_test6_reloc)@h
464 ori r3, r3, (cache_post_test6_1 - cache_post_test6_reloc)@l
466 lis r4, (cache_post_test6_data - cache_post_test6_reloc)@h
467 ori r4, r4, (cache_post_test6_data - cache_post_test6_reloc)@l
472 bl cache_post_iinvalidate
474 /* Replace the test instruction */
475 lis r3, (cache_post_test6_2 - cache_post_test6_reloc)@h
476 ori r3, r3, (cache_post_test6_2 - cache_post_test6_reloc)@l
478 lis r4, (cache_post_test6_data - cache_post_test6_reloc)@h
479 ori r4, r4, (cache_post_test6_data - cache_post_test6_reloc)@l
484 bl cache_post_iinvalidate
486 /* Execute to the test instruction */
487 cache_post_test6_data:
494 #endif /* CONFIG_MPC823 || MPC850 || MPC855 || MPC860 || MPC824X */
495 #endif /* CONFIG_POST & CFG_POST_CACHE */
496 #endif /* CONFIG_POST */