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)
33 #include <ppc_asm.tmpl>
35 #include <asm/cache.h>
37 #if CONFIG_POST & CFG_POST_CACHE
41 cache_post_dinvalidate:
46 cache_post_iinvalidate:
53 lis r10, IDC_DISABLE@h
72 lis r10, IDC_DISABLE@h
97 * turn on the data cache
98 * switch the data cache to write-back or write-through mode
99 * invalidate the data cache
100 * write the negative pattern to a cached area
103 * The negative pattern must be read at the last step
105 .global cache_post_test1
114 bl cache_post_dinvalidate
116 /* Write the negative pattern to the test area */
126 /* Read the test area */
142 bl cache_post_ddisable
143 bl cache_post_dinvalidate
152 * turn on the data cache
153 * switch the data cache to write-back or write-through mode
154 * invalidate the data cache
155 * write the zero pattern to a cached area
156 * turn off the data cache
157 * write the negative pattern to the area
158 * turn on the data cache
161 * The negative pattern must be read at the last step
163 .global cache_post_test2
172 bl cache_post_dinvalidate
174 /* Write the zero pattern to the test area */
184 bl cache_post_ddisable
186 /* Write the negative pattern to the test area */
198 /* Read the test area */
214 bl cache_post_ddisable
215 bl cache_post_dinvalidate
224 * turn on the data cache
225 * switch the data cache to write-through mode
226 * invalidate the data cache
227 * write the zero pattern to a cached area
228 * flush the data cache
229 * write the negative pattern to the area
230 * turn off the data cache
233 * The negative pattern must be read at the last step
235 .global cache_post_test3
243 bl cache_post_ddisable
244 bl cache_post_dinvalidate
246 /* Write the zero pattern to the test area */
257 bl cache_post_dinvalidate
259 /* Write the negative pattern to the test area */
269 bl cache_post_ddisable
270 bl cache_post_dinvalidate
272 /* Read the test area */
295 * turn on the data cache
296 * switch the data cache to write-back mode
297 * invalidate the data cache
298 * write the negative pattern to a cached area
299 * flush the data cache
300 * write the zero pattern to the area
301 * invalidate the data cache
304 * The negative pattern must be read at the last step
306 .global cache_post_test4
314 bl cache_post_ddisable
315 bl cache_post_dinvalidate
317 /* Write the negative pattern to the test area */
328 bl cache_post_dinvalidate
330 /* Write the zero pattern to the test area */
340 bl cache_post_ddisable
341 bl cache_post_dinvalidate
343 /* Read the test area */
371 * turn on the instruction cache
372 * unlock the entire instruction cache
373 * invalidate the instruction cache
374 * lock a branch instruction in the instruction cache
375 * replace the branch instruction with "nop"
376 * jump to the branch instruction
377 * check that the branch instruction was executed
379 .global cache_post_test5
384 bl cache_post_ienable
385 bl cache_post_iunlock
386 bl cache_post_iinvalidate
388 /* Compute r9 = cache_post_test5_reloc */
389 bl cache_post_test5_reloc
390 cache_post_test5_reloc:
393 /* Copy the test instruction to cache_post_test5_data */
394 lis r3, (cache_post_test5_1 - cache_post_test5_reloc)@h
395 ori r3, r3, (cache_post_test5_1 - cache_post_test5_reloc)@l
397 lis r4, (cache_post_test5_data - cache_post_test5_reloc)@h
398 ori r4, r4, (cache_post_test5_data - cache_post_test5_reloc)@l
403 bl cache_post_iinvalidate
405 /* Lock the branch instruction */
406 lis r3, (cache_post_test5_data - cache_post_test5_reloc)@h
407 ori r3, r3, (cache_post_test5_data - cache_post_test5_reloc)@l
411 /* Replace the test instruction */
412 lis r3, (cache_post_test5_2 - cache_post_test5_reloc)@h
413 ori r3, r3, (cache_post_test5_2 - cache_post_test5_reloc)@l
415 lis r4, (cache_post_test5_data - cache_post_test5_reloc)@h
416 ori r4, r4, (cache_post_test5_data - cache_post_test5_reloc)@l
421 bl cache_post_iinvalidate
423 /* Execute to the test instruction */
424 cache_post_test5_data:
427 bl cache_post_iunlock
439 * turn on the instruction cache
440 * unlock the entire instruction cache
441 * invalidate the instruction cache
442 * lock a branch instruction in the instruction cache
443 * replace the branch instruction with "nop"
444 * jump to the branch instruction
445 * check that the branch instruction was executed
447 .global cache_post_test6
452 bl cache_post_ienable
453 bl cache_post_iunlock
454 bl cache_post_iinvalidate
456 /* Compute r9 = cache_post_test6_reloc */
457 bl cache_post_test6_reloc
458 cache_post_test6_reloc:
461 /* Copy the test instruction to cache_post_test6_data */
462 lis r3, (cache_post_test6_1 - cache_post_test6_reloc)@h
463 ori r3, r3, (cache_post_test6_1 - cache_post_test6_reloc)@l
465 lis r4, (cache_post_test6_data - cache_post_test6_reloc)@h
466 ori r4, r4, (cache_post_test6_data - cache_post_test6_reloc)@l
471 bl cache_post_iinvalidate
473 /* Replace the test instruction */
474 lis r3, (cache_post_test6_2 - cache_post_test6_reloc)@h
475 ori r3, r3, (cache_post_test6_2 - cache_post_test6_reloc)@l
477 lis r4, (cache_post_test6_data - cache_post_test6_reloc)@h
478 ori r4, r4, (cache_post_test6_data - cache_post_test6_reloc)@l
483 bl cache_post_iinvalidate
485 /* Execute to the test instruction */
486 cache_post_test6_data:
493 #endif /* CONFIG_MPC823 || MPC850 || MPC855 || MPC860 */
494 #endif /* CONFIG_POST & CFG_POST_CACHE */
495 #endif /* CONFIG_POST */