3 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
5 * See file CREDITS for list of people who contributed to this
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License as
10 * published by the Free Software Foundation; either version 2 of
11 * the License, or (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
28 * Load instructions: lbz(x)(u), lhz(x)(u), lha(x)(u), lwz(x)(u)
30 * All operations are performed on a 16-byte array. The array
31 * is 4-byte aligned. The base register points to offset 8.
32 * The immediate offset (index register) ranges in [-8 ... +7].
33 * The test cases are composed so that they do not
34 * cause alignment exceptions.
35 * The test contains a pre-built table describing all test cases.
36 * The table entry contains:
37 * the instruction opcode, the array contents, the value of the index
38 * register and the expected value of the destination register.
39 * After executing the instruction, the test verifies the
40 * value of the destination register and the value of the base
41 * register (it must change for "load with update" instructions).
49 #if CONFIG_POST & CFG_POST_CPU
51 extern void cpu_post_exec_22w (ulong
*code
, ulong
*op1
, ulong op2
, ulong
*op3
);
52 extern void cpu_post_exec_21w (ulong
*code
, ulong
*op1
, ulong
*op2
);
54 static struct cpu_post_load_s
61 } cpu_post_load_table
[] =
176 static unsigned int cpu_post_load_size
=
177 sizeof (cpu_post_load_table
) / sizeof (struct cpu_post_load_s
);
179 int cpu_post_test_load (void)
184 for (i
= 0; i
< cpu_post_load_size
&& ret
== 0; i
++)
186 struct cpu_post_load_s
*test
= cpu_post_load_table
+ i
;
188 { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 };
189 ulong base0
= (ulong
) (data
+ 8);
197 ASM_12(test
->cmd
, 5, 3, 4),
201 cpu_post_exec_22w (code
, &base
, test
->offset
, &value
);
207 ASM_11I(test
->cmd
, 4, 3, test
->offset
),
211 cpu_post_exec_21w (code
, &base
, &value
);
217 ret
= base
== base0
+ test
->offset
? 0 : -1;
219 ret
= base
== base0
? 0 : -1;
227 ret
= *(uchar
*)(base0
+ test
->offset
) == value
?
231 ret
= *(ushort
*)(base0
+ test
->offset
) == value
?
235 ret
= *(short *)(base0
+ test
->offset
) == value
?
239 ret
= *(ulong
*)(base0
+ test
->offset
) == value
?
247 post_log ("Error at load test %d !\n", i
);