]>
git.ipfire.org Git - people/ms/u-boot.git/blob - post/lib_powerpc/store.c
3 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
5 * SPDX-License-Identifier: GPL-2.0+
12 * Store instructions: stb(x)(u), sth(x)(u), stw(x)(u)
14 * All operations are performed on a 16-byte array. The array
15 * is 4-byte aligned. The base register points to offset 8.
16 * The immediate offset (index register) ranges in [-8 ... +7].
17 * The test cases are composed so that they do not
18 * cause alignment exceptions.
19 * The test contains a pre-built table describing all test cases.
20 * The table entry contains:
21 * the instruction opcode, the value of the index register and
22 * the value of the source register. After executing the
23 * instruction, the test verifies the contents of the array
24 * and the value of the base register (it must change for "store
25 * with update" instructions).
31 #if CONFIG_POST & CONFIG_SYS_POST_CPU
33 extern void cpu_post_exec_12w (ulong
*code
, ulong
*op1
, ulong op2
, ulong op3
);
34 extern void cpu_post_exec_11w (ulong
*code
, ulong
*op1
, ulong op2
);
36 static struct cpu_post_store_s
44 } cpu_post_store_table
[] =
143 static unsigned int cpu_post_store_size
= ARRAY_SIZE(cpu_post_store_table
);
145 int cpu_post_test_store (void)
149 int flag
= disable_interrupts();
151 for (i
= 0; i
< cpu_post_store_size
&& ret
== 0; i
++)
153 struct cpu_post_store_s
*test
= cpu_post_store_table
+ i
;
155 { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 };
156 ulong base0
= (ulong
) (data
+ 8);
163 ASM_12(test
->cmd
, 5, 3, 4),
167 cpu_post_exec_12w (code
, &base
, test
->offset
, test
->value
);
173 ASM_11I(test
->cmd
, 4, 3, test
->offset
),
177 cpu_post_exec_11w (code
, &base
, test
->value
);
183 ret
= base
== base0
+ test
->offset
? 0 : -1;
185 ret
= base
== base0
? 0 : -1;
193 ret
= *(uchar
*)(base0
+ test
->offset
) == test
->value
?
197 ret
= *(ushort
*)(base0
+ test
->offset
) == test
->value
?
201 ret
= *(ulong
*)(base0
+ test
->offset
) == test
->value
?
209 post_log ("Error at store test %d !\n", i
);