]>
git.ipfire.org Git - people/ms/u-boot.git/blob - post/lib_powerpc/load.c
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).
47 #if CONFIG_POST & CONFIG_SYS_POST_CPU
49 extern void cpu_post_exec_22w (ulong
*code
, ulong
*op1
, ulong op2
, ulong
*op3
);
50 extern void cpu_post_exec_21w (ulong
*code
, ulong
*op1
, ulong
*op2
);
52 static struct cpu_post_load_s
59 } cpu_post_load_table
[] =
174 static unsigned int cpu_post_load_size
=
175 sizeof (cpu_post_load_table
) / sizeof (struct cpu_post_load_s
);
177 int cpu_post_test_load (void)
181 int flag
= disable_interrupts();
183 for (i
= 0; i
< cpu_post_load_size
&& ret
== 0; i
++)
185 struct cpu_post_load_s
*test
= cpu_post_load_table
+ i
;
187 { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 };
188 ulong base0
= (ulong
) (data
+ 8);
196 ASM_12(test
->cmd
, 5, 3, 4),
200 cpu_post_exec_22w (code
, &base
, test
->offset
, &value
);
206 ASM_11I(test
->cmd
, 4, 3, test
->offset
),
210 cpu_post_exec_21w (code
, &base
, &value
);
216 ret
= base
== base0
+ test
->offset
? 0 : -1;
218 ret
= base
== base0
? 0 : -1;
226 ret
= *(uchar
*)(base0
+ test
->offset
) == value
?
230 ret
= *(ushort
*)(base0
+ test
->offset
) == value
?
234 ret
= *(short *)(base0
+ test
->offset
) == value
?
238 ret
= *(ulong
*)(base0
+ test
->offset
) == value
?
246 post_log ("Error at load test %d !\n", i
);