]>
git.ipfire.org Git - people/ms/u-boot.git/blob - post/lib_powerpc/threei.c
3 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
5 * SPDX-License-Identifier: GPL-2.0+
12 * Ternary instructions instr rA,rS,UIMM
14 * Logic instructions: ori, oris, xori, xoris
16 * The test contains a pre-built table of instructions, operands and
17 * expected results. For each table entry, the test will cyclically use
18 * different sets of operand registers and result registers.
24 #if CONFIG_POST & CONFIG_SYS_POST_CPU
26 extern void cpu_post_exec_21 (ulong
*code
, ulong
*cr
, ulong
*res
, ulong op
);
27 extern ulong
cpu_post_makecr (long v
);
29 static struct cpu_post_threei_s
35 } cpu_post_threei_table
[] =
62 static unsigned int cpu_post_threei_size
= ARRAY_SIZE(cpu_post_threei_table
);
64 int cpu_post_test_threei (void)
68 int flag
= disable_interrupts();
70 for (i
= 0; i
< cpu_post_threei_size
&& ret
== 0; i
++)
72 struct cpu_post_threei_s
*test
= cpu_post_threei_table
+ i
;
74 for (reg
= 0; reg
< 32 && ret
== 0; reg
++)
76 unsigned int reg0
= (reg
+ 0) % 32;
77 unsigned int reg1
= (reg
+ 1) % 32;
78 unsigned int stk
= reg
< 16 ? 31 : 15;
79 unsigned long code
[] =
82 ASM_ADDI(stk
, 1, -16),
84 ASM_STW(reg0
, stk
, 4),
85 ASM_STW(reg1
, stk
, 0),
86 ASM_LWZ(reg0
, stk
, 8),
87 ASM_11IX(test
->cmd
, reg1
, reg0
, test
->op2
),
88 ASM_STW(reg1
, stk
, 8),
89 ASM_LWZ(reg1
, stk
, 0),
90 ASM_LWZ(reg0
, stk
, 4),
100 cpu_post_exec_21 (code
, & cr
, & res
, test
->op1
);
102 ret
= res
== test
->res
&& cr
== 0 ? 0 : -1;
106 post_log ("Error at threei test %d !\n", i
);