2
* Copyright (C) 2002 Wolfgang Denk <wd@denx.de>
4
* SPDX-License-Identifier: GPL-2.0+
9
#if defined(CONFIG_MPC823) || \
10
defined(CONFIG_MPC850) || \
11
defined(CONFIG_MPC855) || \
12
defined(CONFIG_MPC860) || \
13
defined(CONFIG_MPC862)
16
#include <ppc_asm.tmpl>
18
#include <asm/cache.h>
20
#if CONFIG_POST & CONFIG_SYS_POST_CACHE
24
cache_post_dinvalidate:
29
cache_post_iinvalidate:
36
lis r10, IDC_DISABLE@h
55
lis r10, IDC_DISABLE@h
80
* turn on the data cache
81
* switch the data cache to write-back or write-through mode
82
* invalidate the data cache
83
* write the negative pattern to a cached area
86
* The negative pattern must be read at the last step
88
.global cache_post_test1
97
bl cache_post_dinvalidate
99
/* Write the negative pattern to the test area */
109
/* Read the test area */
125
bl cache_post_ddisable
126
bl cache_post_dinvalidate
135
* turn on the data cache
136
* switch the data cache to write-back or write-through mode
137
* invalidate the data cache
138
* write the zero pattern to a cached area
139
* turn off the data cache
140
* write the negative pattern to the area
141
* turn on the data cache
144
* The negative pattern must be read at the last step
146
.global cache_post_test2
155
bl cache_post_dinvalidate
157
/* Write the zero pattern to the test area */
167
bl cache_post_ddisable
169
/* Write the negative pattern to the test area */
181
/* Read the test area */
197
bl cache_post_ddisable
198
bl cache_post_dinvalidate
207
* turn on the data cache
208
* switch the data cache to write-through mode
209
* invalidate the data cache
210
* write the zero pattern to a cached area
211
* flush the data cache
212
* write the negative pattern to the area
213
* turn off the data cache
216
* The negative pattern must be read at the last step
218
.global cache_post_test3
226
bl cache_post_ddisable
227
bl cache_post_dinvalidate
229
/* Write the zero pattern to the test area */
240
bl cache_post_dinvalidate
242
/* Write the negative pattern to the test area */
252
bl cache_post_ddisable
253
bl cache_post_dinvalidate
255
/* Read the test area */
278
* turn on the data cache
279
* switch the data cache to write-back mode
280
* invalidate the data cache
281
* write the negative pattern to a cached area
282
* flush the data cache
283
* write the zero pattern to the area
284
* invalidate the data cache
287
* The negative pattern must be read at the last step
289
.global cache_post_test4
297
bl cache_post_ddisable
298
bl cache_post_dinvalidate
300
/* Write the negative pattern to the test area */
311
bl cache_post_dinvalidate
313
/* Write the zero pattern to the test area */
323
bl cache_post_ddisable
324
bl cache_post_dinvalidate
326
/* Read the test area */
354
* turn on the instruction cache
355
* unlock the entire instruction cache
356
* invalidate the instruction cache
357
* lock a branch instruction in the instruction cache
358
* replace the branch instruction with "nop"
359
* jump to the branch instruction
360
* check that the branch instruction was executed
362
.global cache_post_test5
367
bl cache_post_ienable
368
bl cache_post_iunlock
369
bl cache_post_iinvalidate
371
/* Compute r9 = cache_post_test5_reloc */
372
bl cache_post_test5_reloc
373
cache_post_test5_reloc:
376
/* Copy the test instruction to cache_post_test5_data */
377
lis r3, (cache_post_test5_1 - cache_post_test5_reloc)@h
378
ori r3, r3, (cache_post_test5_1 - cache_post_test5_reloc)@l
380
lis r4, (cache_post_test5_data - cache_post_test5_reloc)@h
381
ori r4, r4, (cache_post_test5_data - cache_post_test5_reloc)@l
386
bl cache_post_iinvalidate
388
/* Lock the branch instruction */
389
lis r3, (cache_post_test5_data - cache_post_test5_reloc)@h
390
ori r3, r3, (cache_post_test5_data - cache_post_test5_reloc)@l
394
/* Replace the test instruction */
395
lis r3, (cache_post_test5_2 - cache_post_test5_reloc)@h
396
ori r3, r3, (cache_post_test5_2 - 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
/* Execute to the test instruction */
407
cache_post_test5_data:
410
bl cache_post_iunlock
422
* turn on the instruction cache
423
* unlock the entire instruction cache
424
* invalidate the instruction cache
425
* lock a branch instruction in the instruction cache
426
* replace the branch instruction with "nop"
427
* jump to the branch instruction
428
* check that the branch instruction was executed
430
.global cache_post_test6
435
bl cache_post_ienable
436
bl cache_post_iunlock
437
bl cache_post_iinvalidate
439
/* Compute r9 = cache_post_test6_reloc */
440
bl cache_post_test6_reloc
441
cache_post_test6_reloc:
444
/* Copy the test instruction to cache_post_test6_data */
445
lis r3, (cache_post_test6_1 - cache_post_test6_reloc)@h
446
ori r3, r3, (cache_post_test6_1 - cache_post_test6_reloc)@l
448
lis r4, (cache_post_test6_data - cache_post_test6_reloc)@h
449
ori r4, r4, (cache_post_test6_data - cache_post_test6_reloc)@l
454
bl cache_post_iinvalidate
456
/* Replace the test instruction */
457
lis r3, (cache_post_test6_2 - cache_post_test6_reloc)@h
458
ori r3, r3, (cache_post_test6_2 - cache_post_test6_reloc)@l
460
lis r4, (cache_post_test6_data - cache_post_test6_reloc)@h
461
ori r4, r4, (cache_post_test6_data - cache_post_test6_reloc)@l
466
bl cache_post_iinvalidate
468
/* Execute to the test instruction */
469
cache_post_test6_data:
476
#endif /* CONFIG_MPC823 || MPC850 || MPC855 || MPC860 */
477
#endif /* CONFIG_POST & CONFIG_SYS_POST_CACHE */